Skip to contentSkip to conversation

libvhost-user: Fix wrong type of argument to formatting function (reported by LGTM)

PATCH In review Stefan Weil 2 participants 3 messages Jan 7, 2022 – Feb 24, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libvhost-user: Fix wrong type of argument to formatting function (reported by LGTM)

---

LGTM has some more alerts which need attention:
https://lgtm.com/projects/g/qemu/qemu/

Regards,
Stefan

 subprojects/libvhost-user/libvhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
subprojects/libvhost-user/libvhost-user.c +1 -1
index 787f4d2d4f..6eb72c4200 100644
@@ -651,7 +651,7 @@ generate_faults(VuDev *dev) {
 
         if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, &reg_struct)) {
             vu_panic(dev, "%s: Failed to userfault region %d "
-                          "@%p + size:%zx offset: %zx: (ufd=%d)%s\n",
+                          "@%" PRIx64 " + size:%zx offset: %zx: (ufd=%d)%s\n",
                      __func__, i,
                      dev_region->mmap_addr,
                      dev_region->size, dev_region->mmap_offset,
Signature · 1 line
2.30.2
#1 lore raw

Am 07.01.22 um 16:49 schrieb Stefan Weil:

Quoted 17 lines

---

LGTM has some more alerts which need attention:
https://lgtm.com/projects/g/qemu/qemu/

Regards,
Stefan

  subprojects/libvhost-user/libvhost-user.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
subprojects/libvhost-user/libvhost-user.c +0 -0
index 787f4d2d4f..6eb72c4200 100644

subprojects/libvhost-user/libvhost-user.c generate_faults(VuDev *dev) { · line 657

Quoted 8 lines
subprojects/libvhost-user/libvhost-user.c +1 -1
@@ -651,7 +651,7 @@ generate_faults(VuDev *dev) {
 
          if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, &reg_struct)) {
              vu_panic(dev, "%s: Failed to userfault region %d "
-                          "@%p + size:%zx offset: %zx: (ufd=%d)%s\n",
+                          "@%" PRIx64 " + size:%zx offset: %zx: (ufd=%d)%s\n",
                       __func__, i,
                       dev_region->mmap_addr,
                       dev_region->size, dev_region->mmap_offset,

Up to now I did not see any response to this patch, and it is also still missing in the latest code.

dev_region->mmap_addr is an uint64_t value, so the current format string "%p" won't work on any platform where pointers are not 64 bit value.

Stefan

#2 lore raw
Quoted 31 lines · Stefan Weil

Am 07.01.22 um 16:49 schrieb Stefan Weil:

Quoted 18 lines

---

LGTM has some more alerts which need attention:
https://lgtm.com/projects/g/qemu/qemu/

Regards,
Stefan

  subprojects/libvhost-user/libvhost-user.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
subprojects/libvhost-user/libvhost-user.c +0 -0
index 787f4d2d4f..6eb72c4200 100644
@@ -651,7 +651,7 @@ generate_faults(VuDev *dev) {
           if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, &reg_struct)) {
Quoted 7 lines

              vu_panic(dev, "%s: Failed to userfault region %d " -                          "@%p + size:%zx offset: %zx: (ufd=%d)%s\n", +                          "@%" PRIx64 " + size:%zx offset: %zx:
(ufd=%d)%s\n",
                       __func__, i,
                       dev_region->mmap_addr, dev_region->size, dev_region->mmap_offset,

Up to now I did not see any response to this patch, and it is also still missing in the latest code.

Quoted 6 lines

dev_region->mmap_addr is an uint64_t value, so the current format string "%p" won't work on any platform where pointers are not 64 bit value.

Stefan