qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 for-7.2 0/4] libvhost-user: Add format attribute and fix format strings
@ 2022-11-05 10:24 Stefan Weil via
  2022-11-05 10:24 ` [PATCH v2 1/4] libvhost-user: Fix wrong type of argument to formatting function (reported by LGTM) Stefan Weil via
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Stefan Weil via @ 2022-11-05 10:24 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: Stefan Hajnoczi, Laurent Vivier

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



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

* [PATCH v2 1/4] libvhost-user: Fix wrong type of argument to formatting function (reported by LGTM)
  2022-11-05 10:24 [PATCH v2 for-7.2 0/4] libvhost-user: Add format attribute and fix format strings Stefan Weil via
@ 2022-11-05 10:24 ` Stefan Weil via
  2022-11-05 10:24 ` [PATCH v2 2/4] libvhost-user: Fix format strings Stefan Weil via
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Stefan Weil via @ 2022-11-05 10:24 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Stefan Hajnoczi, Laurent Vivier, Stefan Weil,
	Philippe Mathieu-Daudé

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-Id: <20220422070144.1043697-2-sw@weilnetz.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 subprojects/libvhost-user/libvhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index ffed4729a3..d9a6e3e556 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -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,
-- 
2.30.2



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

* [PATCH v2 2/4] libvhost-user: Fix format strings
  2022-11-05 10:24 [PATCH v2 for-7.2 0/4] libvhost-user: Add format attribute and fix format strings Stefan Weil via
  2022-11-05 10:24 ` [PATCH v2 1/4] libvhost-user: Fix wrong type of argument to formatting function (reported by LGTM) Stefan Weil via
@ 2022-11-05 10:24 ` Stefan Weil via
  2022-11-05 10:24 ` [PATCH v2 3/4] libvhost-user: Fix two more " Stefan Weil via
  2022-11-05 10:24 ` [PATCH v2 4/4] libvhost-user: Add format attribute to local function vu_panic Stefan Weil via
  3 siblings, 0 replies; 10+ messages in thread
From: Stefan Weil via @ 2022-11-05 10:24 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Stefan Hajnoczi, Laurent Vivier, Stefan Weil,
	Marc-André Lureau

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220422070144.1043697-3-sw@weilnetz.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 subprojects/libvhost-user/libvhost-user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index d9a6e3e556..d67953a1c3 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -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;
     }
-- 
2.30.2



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

* [PATCH v2 3/4] libvhost-user: Fix two more format strings
  2022-11-05 10:24 [PATCH v2 for-7.2 0/4] libvhost-user: Add format attribute and fix format strings Stefan Weil via
  2022-11-05 10:24 ` [PATCH v2 1/4] libvhost-user: Fix wrong type of argument to formatting function (reported by LGTM) Stefan Weil via
  2022-11-05 10:24 ` [PATCH v2 2/4] libvhost-user: Fix format strings Stefan Weil via
@ 2022-11-05 10:24 ` Stefan Weil via
  2022-11-05 11:06   ` Stefan Weil via
  2022-11-15  7:25   ` [PATCH for-7.2 " Stefan Weil via
  2022-11-05 10:24 ` [PATCH v2 4/4] libvhost-user: Add format attribute to local function vu_panic Stefan Weil via
  3 siblings, 2 replies; 10+ messages in thread
From: Stefan Weil via @ 2022-11-05 10:24 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: Stefan Hajnoczi, Laurent Vivier, Stefan Weil

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 <stefanha@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 subprojects/libvhost-user/libvhost-user.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index d67953a1c3..80f9952e71 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -651,7 +651,8 @@ generate_faults(VuDev *dev) {
 
         if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, &reg_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,
-- 
2.30.2



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

* [PATCH v2 4/4] libvhost-user: Add format attribute to local function vu_panic
  2022-11-05 10:24 [PATCH v2 for-7.2 0/4] libvhost-user: Add format attribute and fix format strings Stefan Weil via
                   ` (2 preceding siblings ...)
  2022-11-05 10:24 ` [PATCH v2 3/4] libvhost-user: Fix two more " Stefan Weil via
@ 2022-11-05 10:24 ` Stefan Weil via
  3 siblings, 0 replies; 10+ messages in thread
From: Stefan Weil via @ 2022-11-05 10:24 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Stefan Hajnoczi, Laurent Vivier, Stefan Weil,
	Marc-André Lureau

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220422070144.1043697-4-sw@weilnetz.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 subprojects/libvhost-user/libvhost-user.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index 80f9952e71..d6ee6e7d91 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -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;
-- 
2.30.2



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

* Re: [PATCH v2 3/4] libvhost-user: Fix two more format strings
  2022-11-05 10:24 ` [PATCH v2 3/4] libvhost-user: Fix two more " Stefan Weil via
@ 2022-11-05 11:06   ` Stefan Weil via
  2022-11-15  7:25   ` [PATCH for-7.2 " Stefan Weil via
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Weil via @ 2022-11-05 11:06 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: Stefan Hajnoczi, Laurent Vivier

Am 05.11.22 um 11:24 schrieb Stefan Weil via:

> 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



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

* Re: [PATCH for-7.2 v2 3/4] libvhost-user: Fix two more format strings
  2022-11-05 10:24 ` [PATCH v2 3/4] libvhost-user: Fix two more " Stefan Weil via
  2022-11-05 11:06   ` Stefan Weil via
@ 2022-11-15  7:25   ` Stefan Weil via
  2022-11-23  6:35     ` Stefan Weil via
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Weil via @ 2022-11-15  7:25 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: Stefan Hajnoczi, Laurent Vivier

Am 05.11.22 um 11:24 schrieb Stefan Weil:

> 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 <stefanha@gmail.com>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>   subprojects/libvhost-user/libvhost-user.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
> index d67953a1c3..80f9952e71 100644
> --- a/subprojects/libvhost-user/libvhost-user.c
> +++ b/subprojects/libvhost-user/libvhost-user.c
> @@ -651,7 +651,8 @@ generate_faults(VuDev *dev) {
>   
>           if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, &reg_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




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

* Re: [PATCH for-7.2 v2 3/4] libvhost-user: Fix two more format strings
  2022-11-15  7:25   ` [PATCH for-7.2 " Stefan Weil via
@ 2022-11-23  6:35     ` Stefan Weil via
  2022-11-23  6:49       ` Stefan Weil via
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Weil via @ 2022-11-23  6:35 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: Stefan Hajnoczi, Laurent Vivier


[-- Attachment #1.1.1: Type: text/plain, Size: 1702 bytes --]

Am 15.11.22 um 08:25 schrieb Stefan Weil:
> Am 05.11.22 um 11:24 schrieb Stefan Weil:
> 
>> 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 <stefanha@gmail.com>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>> ---
>>   subprojects/libvhost-user/libvhost-user.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/subprojects/libvhost-user/libvhost-user.c 
>> b/subprojects/libvhost-user/libvhost-user.c
>> index d67953a1c3..80f9952e71 100644
>> --- a/subprojects/libvhost-user/libvhost-user.c
>> +++ b/subprojects/libvhost-user/libvhost-user.c
>> @@ -651,7 +651,8 @@ generate_faults(VuDev *dev) {
>>           if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, &reg_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

Ping? Those bug fixes are still missing in -rc2.

Stefan

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 6511 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH for-7.2 v2 3/4] libvhost-user: Fix two more format strings
  2022-11-23  6:35     ` Stefan Weil via
@ 2022-11-23  6:49       ` Stefan Weil via
  2022-11-23  6:52         ` Michael S. Tsirkin
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Weil via @ 2022-11-23  6:49 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial, Michael S. Tsirkin
  Cc: Stefan Hajnoczi, Laurent Vivier, Kevin Wolf

Am 23.11.22 um 07:35 schrieb Stefan Weil:
> Am 15.11.22 um 08:25 schrieb Stefan Weil:
>> Am 05.11.22 um 11:24 schrieb Stefan Weil:
>>
>>> 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 <stefanha@gmail.com>
>>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>>> ---
>>>   subprojects/libvhost-user/libvhost-user.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/subprojects/libvhost-user/libvhost-user.c 
>>> b/subprojects/libvhost-user/libvhost-user.c
>>> index d67953a1c3..80f9952e71 100644
>>> --- a/subprojects/libvhost-user/libvhost-user.c
>>> +++ b/subprojects/libvhost-user/libvhost-user.c
>>> @@ -651,7 +651,8 @@ generate_faults(VuDev *dev) {
>>>           if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, &reg_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
> 
> 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


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

* Re: [PATCH for-7.2 v2 3/4] libvhost-user: Fix two more format strings
  2022-11-23  6:49       ` Stefan Weil via
@ 2022-11-23  6:52         ` Michael S. Tsirkin
  0 siblings, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2022-11-23  6:52 UTC (permalink / raw)
  To: Stefan Weil
  Cc: qemu-devel, qemu-trivial, Stefan Hajnoczi, Laurent Vivier,
	Kevin Wolf

On Wed, Nov 23, 2022 at 07:49:53AM +0100, Stefan Weil wrote:
> Am 23.11.22 um 07:35 schrieb Stefan Weil:
> > Am 15.11.22 um 08:25 schrieb Stefan Weil:
> > > Am 05.11.22 um 11:24 schrieb Stefan Weil:
> > > 
> > > > 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 <stefanha@gmail.com>
> > > > Signed-off-by: Stefan Weil <sw@weilnetz.de>
> > > > ---
> > > >   subprojects/libvhost-user/libvhost-user.c | 3 ++-
> > > >   1 file changed, 2 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/subprojects/libvhost-user/libvhost-user.c
> > > > b/subprojects/libvhost-user/libvhost-user.c
> > > > index d67953a1c3..80f9952e71 100644
> > > > --- a/subprojects/libvhost-user/libvhost-user.c
> > > > +++ b/subprojects/libvhost-user/libvhost-user.c
> > > > @@ -651,7 +651,8 @@ generate_faults(VuDev *dev) {
> > > >           if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER, &reg_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
> > 
> > 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

pls do



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

end of thread, other threads:[~2022-11-23  6:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-05 10:24 [PATCH v2 for-7.2 0/4] libvhost-user: Add format attribute and fix format strings Stefan Weil via
2022-11-05 10:24 ` [PATCH v2 1/4] libvhost-user: Fix wrong type of argument to formatting function (reported by LGTM) Stefan Weil via
2022-11-05 10:24 ` [PATCH v2 2/4] libvhost-user: Fix format strings Stefan Weil via
2022-11-05 10:24 ` [PATCH v2 3/4] libvhost-user: Fix two more " Stefan Weil via
2022-11-05 11:06   ` Stefan Weil via
2022-11-15  7:25   ` [PATCH for-7.2 " Stefan Weil via
2022-11-23  6:35     ` Stefan Weil via
2022-11-23  6:49       ` Stefan Weil via
2022-11-23  6:52         ` Michael S. Tsirkin
2022-11-05 10:24 ` [PATCH v2 4/4] libvhost-user: Add format attribute to local function vu_panic Stefan Weil via

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