libvhost-user: Add format attribute and fix format strings
v2 cover libvhost-user: Add format attribute and fix format strings
v2: Add patch 3 to fix two more format strings before applying patch 4
[PATCH v2 1/4] libvhost-user: Fix wrong type of argument to [PATCH v2 2/4] libvhost-user: Fix format strings
[PATCH v2 3/4] libvhost-user: Fix two more format strings [PATCH v2 4/4] libvhost-user: Add format attribute to local function
PATCH v2 1/4 libvhost-user: Fix wrong type of argument to formatting function (reported by LGTM)
Message-Id: <[email protected]>
--- subprojects/libvhost-user/libvhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
subprojects/libvhost-user/libvhost-user.c +1 -1
@@ -651,7 +651,7 @@ generate_faults(VuDev *dev) {if (ioctl (dev->postcopy_ufd,UFFDIO_REGISTER , ®_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
PATCH v2 2/4 libvhost-user: Fix format strings
In reply to Stefan Weil viaMessage-Id: <[email protected]>
--- subprojects/libvhost-user/libvhost-user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
subprojects/libvhost-user/libvhost-user.c +2 -2
@@ -700,7 +700,7 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {if (vmsg->size <VHOST_USER_MEM_REG_SIZE ) {close (vmsg->fds[0 ]);vu_panic (dev,"VHOST_USER_ADD_MEM_REG requires a message size of at " -"least %d bytes and only %d bytes were received" , +"least %zu bytes and only %d bytes were received" ,VHOST_USER_MEM_REG_SIZE , vmsg->size);return false; }
@@ -826,7 +826,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {if (vmsg->size <VHOST_USER_MEM_REG_SIZE ) {vmsg_close_fds (vmsg);vu_panic (dev,"VHOST_USER_REM_MEM_REG requires a message size of at " -"least %d bytes and only %d bytes were received" , +"least %zu bytes and only %d bytes were received" ,VHOST_USER_MEM_REG_SIZE , vmsg->size);return false; }
Signature · 1 line
2.30.2
PATCH v2 3/4 libvhost-user: Fix two more format strings
In reply to Stefan Weil viaThis fix is required for 32 bit host. The bug was detected by CI for arm-linux, but is also relevant for i386-linux.
--- subprojects/libvhost-user/libvhost-user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
subprojects/libvhost-user/libvhost-user.c +2 -1
@@ -651,7 +651,8 @@ generate_faults(VuDev *dev) {if (ioctl (dev->postcopy_ufd,UFFDIO_REGISTER , ®_struct)) { vu_panic(dev, "%s: Failed to userfault region %d " - "@%" PRIx64 " + size:%zx offset: %zx: (ufd=%d)%s\n", + "@%" PRIx64 " + size:%" PRIx64 " offset: %" PRIx64 + ": (ufd=%d)%s\n", __func__, i, dev_region->mmap_addr, dev_region->size, dev_region->mmap_offset,
Signature · 1 line
2.30.2
Re: [PATCH v2 3/4] libvhost-user: Fix two more format strings
Am 05.11.22 um 11:24 schrieb Stefan Weil via:
Quoted 2 lines
This fix is required for 32 bit host. The bug was detected by CI for arm-linux, but is also relevant for i386-linux.
s/host/hosts/
I won't send a v3 for that. Maybe it can be fixed when merging this patch.
Stefan
Re: [PATCH for-7.2 v2 3/4] libvhost-user: Fix two more format strings
In reply to Stefan Weil viaAm 05.11.22 um 11:24 schrieb Stefan Weil:
Quoted 14 lines
This fix is required for 32 bit host. The bug was detected by CI for arm-linux, but is also relevant for i386-linux.
Reported-by Stefan Hajnoczi <[email protected]>Signed-off-by Stefan Weil <[email protected]>--- subprojects/libvhost-user/libvhost-user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)subprojects/libvhost-user/libvhost-user.c +0
-0
subprojects/libvhost-user/libvhost-user.c generate_faults(VuDev *dev) { · line 658
Quoted 9 lines
subprojects/libvhost-user/libvhost-user.c +2
-1@@ -651,7 +651,8 @@ generate_faults(VuDev *dev) {if (ioctl (dev->postcopy_ufd,UFFDIO_REGISTER , ®_struct)) { vu_panic(dev, "%s: Failed to userfault region %d " - "@%" PRIx64 " + size:%zx offset: %zx: (ufd=%d)%s\n", + "@%" PRIx64 " + size:%" PRIx64 " offset: %" PRIx64 + ": (ufd=%d)%s\n", __func__, i, dev_region->mmap_addr, dev_region->size, dev_region->mmap_offset,
There is still no review for this patch.
I added "for-7.2" to the subject here in my answer. How can we get all 4 patches of this series into the new release?
Stefan
Re: [PATCH for-7.2 v2 3/4] libvhost-user: Fix two more format strings
Am 15.11.22 um 08:25 schrieb Stefan Weil:
Quoted 30 lines
Am 05.11.22 um 11:24 schrieb Stefan Weil:
Quoted 16 lines
This fix is required for 32 bit host. The bug was detected by CI for arm-linux, but is also relevant for i386-linux.
Reported-by Stefan Hajnoczi <[email protected]>Signed-off-by Stefan Weil <[email protected]>---
subprojects/libvhost-user/libvhost-user.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)subprojects/libvhost-user/libvhost-user.c +0
-0@@ -651,7 +651,8 @@ generate_faults(VuDev *dev) { if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, ®_struct)) {vu_panic(dev, "%s: Failed to userfault region %d "
Quoted 8 lines
- "@%" PRIx64 " + size:%zx offset: %zx:
(ufd=%d)%s\n",
+ "@%" PRIx64 " + size:%" PRIx64 " offset: %" PRIx64
+ ": (ufd=%d)%s\n",
__func__, i,
dev_region->mmap_addr,dev_region->size,dev_region->mmap_offset,There is still no review for this patch.
Quoted 3 lines
I added "for-7.2" to the subject here in my answer. How can we get all 4 patches of this series into the new release?
Stefan
Ping? Those bug fixes are still missing in -rc2.
Stefan
Re: [PATCH for-7.2 v2 3/4] libvhost-user: Fix two more format strings
Am 23.11.22 um 07:35 schrieb Stefan Weil:
Quoted 31 lines
Am 15.11.22 um 08:25 schrieb Stefan Weil:
Quoted 30 lines
Am 05.11.22 um 11:24 schrieb Stefan Weil:
Quoted 16 lines
This fix is required for 32 bit host. The bug was detected by CI for arm-linux, but is also relevant for i386-linux.
Reported-by Stefan Hajnoczi <[email protected]>Signed-off-by Stefan Weil <[email protected]>---
subprojects/libvhost-user/libvhost-user.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)subprojects/libvhost-user/libvhost-user.c +0
-0@@ -651,7 +651,8 @@ generate_faults(VuDev *dev) { if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, ®_struct)) {vu_panic(dev, "%s: Failed to userfault region %d "
Quoted 8 lines
- "@%" PRIx64 " + size:%zx offset: %zx:
(ufd=%d)%s\n",
+ "@%" PRIx64 " + size:%" PRIx64 " offset:
%" PRIx64
+ ": (ufd=%d)%s\n",
__func__, i,dev_region->mmap_addr,dev_region->size,dev_region->mmap_offset,There is still no review for this patch.
Quoted 7 lines
Quoted 3 lines
I added "for-7.2" to the subject here in my answer. How can we get all 4 patches of this series into the new release?
Stefan
Ping? Those bug fixes are still missing in -rc2.
Stefan
Hello Michael,
I just noticed that MAINTAINERS has no entry for the files in subprojects/libvhost-user, so I did not cc you in my previous e-mails. Should that directory be added to the "vhost" section"?
Stefan
Re: [PATCH for-7.2 v2 3/4] libvhost-user: Fix two more format strings
Quoted 42 lines · Stefan Weil
Am 23.11.22 um 07:35 schrieb Stefan Weil:
Quoted 32 lines
Am 15.11.22 um 08:25 schrieb Stefan Weil:
Quoted 31 lines
Am 05.11.22 um 11:24 schrieb Stefan Weil:
Quoted 17 lines
This fix is required for 32 bit host. The bug was detected by CI for arm-linux, but is also relevant for i386-linux.
Reported-by Stefan Hajnoczi <[email protected]>Signed-off-by Stefan Weil <[email protected]>---
subprojects/libvhost-user/libvhost-user.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)subprojects/libvhost-user/libvhost-user.c +0
-0@@ -651,7 +651,8 @@ generate_faults(VuDev *dev) { if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, ®_struct)) {vu_panic(dev, "%s: Failed to userfault region %d "
Quoted 8 lines
- "@%" PRIx64 " + size:%zx offset: %zx:
(ufd=%d)%s\n",
+ "@%" PRIx64 " + size:%" PRIx64 "
offset: %" PRIx64
+ ": (ufd=%d)%s\n",
__func__, i,dev_region->mmap_addr,dev_region->size,dev_region->mmap_offset,There is still no review for this patch.
Quoted 8 lines
Quoted 4 lines
I added "for-7.2" to the subject here in my answer. How can we get all 4 patches of this series into the new release?
Stefan
Ping? Those bug fixes are still missing in -rc2.
Stefan
Quoted 7 lines
Hello Michael,
I just noticed that
MAINTAINERShas no entry for the files in subprojects/libvhost-user, so I did not cc you in my previous e-mails. Should that directory be added to the "vhost" section"?Stefan
pls do
PATCH v2 4/4 libvhost-user: Add format attribute to local function vu_panic
In reply to Stefan Weil viaMessage-Id: <[email protected]>
--- subprojects/libvhost-user/libvhost-user.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
subprojects/libvhost-user/libvhost-user.c +12 -1
@@ -45,6 +45,17 @@#include "libvhost-user.h" /* usually provided by GLib */ +#if __GNUC__ >2 || (__GNUC__ ==2 && __GNUC_MINOR__ >4 ) +#if !defined(__clang__) && (__GNUC__ ==4 && __GNUC_MINOR__ ==4 ) +#define G_GNUC_PRINTF (format_idx, arg_idx) \ + __attribute__((__format__(gnu_printf, format_idx, arg_idx))) +#else +#define G_GNUC_PRINTF (format_idx, arg_idx) \ + __attribute__((__format__(__printf__, format_idx, arg_idx))) +#endif +#else /* !__GNUC__ */ +#define G_GNUC_PRINTF (format_idx, arg_idx) +#endif /* !__GNUC__ */ #ifndef MIN #define MIN (x, y) ({ \ typeof(x) _min1 = (x); \
@@ -151,7 +162,7 @@ vu_request_to_string(unsigned int req) } } -static void +static void G_GNUC_PRINTF(2, 3) vu_panic(VuDev *dev, const char *msg, ...) {char *buf =NULL ;
Signature · 1 line
2.30.2