qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] libvhost-user: Add missing GCC_FMT_ATTR and fix three format errors
@ 2019-07-12 11:50 Stefan Weil
  2019-07-12 13:13 ` Philippe Mathieu-Daudé
  2019-07-16 14:28 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2019-07-12 11:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Philippe Mathieu-Daudé,
	Stefan Hajnoczi, Stefan Weil

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

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(-)

diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
index 4b36e35a82..3b5520a77f 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -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, &reg_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;
     }
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] libvhost-user: Add missing GCC_FMT_ATTR and fix three format errors
  2019-07-12 11:50 [Qemu-devel] [PATCH v2] libvhost-user: Add missing GCC_FMT_ATTR and fix three format errors Stefan Weil
@ 2019-07-12 13:13 ` Philippe Mathieu-Daudé
  2019-07-16 14:28 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-12 13:13 UTC (permalink / raw)
  To: Stefan Weil, qemu-devel; +Cc: Marc-André Lureau, Stefan Hajnoczi

On 7/12/19 1:50 PM, Stefan Weil wrote:
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> 
> 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.

> Regards
> Stefan
> 
> 
>  contrib/libvhost-user/libvhost-user.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> index 4b36e35a82..3b5520a77f 100644
> --- a/contrib/libvhost-user/libvhost-user.c
> +++ b/contrib/libvhost-user/libvhost-user.c
> @@ -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, &reg_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;
>      }
>  
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] libvhost-user: Add missing GCC_FMT_ATTR and fix three format errors
  2019-07-12 11:50 [Qemu-devel] [PATCH v2] libvhost-user: Add missing GCC_FMT_ATTR and fix three format errors Stefan Weil
  2019-07-12 13:13 ` Philippe Mathieu-Daudé
@ 2019-07-16 14:28 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2019-07-16 14:28 UTC (permalink / raw)
  To: Stefan Weil
  Cc: Marc-André Lureau, Philippe Mathieu-Daudé, qemu-devel,
	Stefan Hajnoczi

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-16 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-12 11:50 [Qemu-devel] [PATCH v2] libvhost-user: Add missing GCC_FMT_ATTR and fix three format errors Stefan Weil
2019-07-12 13:13 ` Philippe Mathieu-Daudé
2019-07-16 14:28 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).