libvhost-user: Add missing GCC_FMT_ATTR and fix three format errors
PATCH v2 1/1 libvhost-user: Add missing GCC_FMT_ATTR and fix three format errors
Reviewed-by Marc-André Lureau <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Signed-off-by Stefan Weil <[email protected]>
---
v2:
- Show different value in "Guest says [...]" (suggested by Marc-André Lureau)
- Fix more format errors for 32 bit builds (reported by Philippe Mathieu-Daudé)
Philippe, I did not get the additional errors on x86_64.
Regards
Stefan
contrib/libvhost-user/libvhost-user.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
contrib/libvhost-user/libvhost-user.c +5 -4
@@ -142,7 +142,7 @@ vu_request_to_string(unsigned int req) } } -static void +static void GCC_FMT_ATTR(2, 3) vu_panic(VuDev *dev, const char *msg, ...) {char *buf =NULL ;
@@ -661,7 +661,8 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)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:%" PRIx64 + " offset: %" PRIx64 ": (ufd=%d)%s\n", __func__, i, dev_region->mmap_addr, dev_region->size, dev_region->mmap_offset,
@@ -1753,7 +1754,7 @@ virtqueue_get_head(VuDev *dev, VuVirtq *vq,/* If their number is silly, that's a fatal mistake. */ if (*head >= vq->vring.num) { -vu_panic (dev,"Guest says index %u is available" , head); +vu_panic (dev,"Guest says index %u is available" , *head);return false; }
@@ -1812,7 +1813,7 @@ virtqueue_read_next_desc(VuDev *dev, struct vring_desc *desc,smp_wmb ();if (*next >= max) { -vu_panic (dev,"Desc next is %u" , next); +vu_panic (dev,"Desc next is %u" , *next);return VIRTQUEUE_READ_DESC_ERROR ; }
Signature · 1 line
2.20.1
Quoted 11 lines · Stefan Weil
Reviewed-by Marc-André Lureau <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Stefan Weil <[email protected]>---
v2:
- Show different value in "Guest says [...]" (suggested by Marc-André Lureau)
- Fix more format errors for 32 bit builds (reported by Philippe Mathieu-Daudé)Philippe, I did not get the additional errors on
x86_64.
Works for me! I was testing on armhf host.
Thanks for the quick v2,
Phil.
Quoted 49 lines
Regards
Stefancontrib/libvhost-user/libvhost-user.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)contrib/libvhost-user/libvhost-user.c +5
-4@@ -142,7 +142,7 @@ vu_request_to_string(unsigned int req) } } -static void +static void GCC_FMT_ATTR(2, 3) vu_panic(VuDev *dev, const char *msg, ...) {char *buf =NULL ;@@ -661,7 +661,8 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)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:%" PRIx64 + " offset: %" PRIx64 ": (ufd=%d)%s\n", __func__, i, dev_region->mmap_addr, dev_region->size, dev_region->mmap_offset,@@ -1753,7 +1754,7 @@ virtqueue_get_head(VuDev *dev, VuVirtq *vq,/* If their number is silly, that's a fatal mistake. */ if (*head >= vq->vring.num) { -vu_panic (dev,"Guest says index %u is available" , head); +vu_panic (dev,"Guest says index %u is available" , *head);return false; }@@ -1812,7 +1813,7 @@ virtqueue_read_next_desc(VuDev *dev, struct vring_desc *desc,smp_wmb ();if (*next >= max) { -vu_panic (dev,"Desc next is %u" , next); +vu_panic (dev,"Desc next is %u" , *next);return VIRTQUEUE_READ_DESC_ERROR ; }
Reviewed-by Stefan Hajnoczi <[email protected]>