Trivial portability fix: missing va_end()
cover Trivial portability fix: missing va_end()
Markus Armbruster (2):
sysbus: Supply missing va_end()
hw/9pfs: Supply missing va_end()
hw/9pfs/virtio-9p.c | 4 ++++ hw/sysbus.c | 2 ++ 2 files changed, 6 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.6.4
PATCH 2/2 hw/9pfs: Supply missing va_end()
C99 7.15.1: Each invocation of the va_start and va_copy macros shall be matched by a corresponding invocation of the va_end macro in the same function.
Spotted by Coverity. Harmless on the (common) systems where va_end() does nothing.
--- hw/9pfs/virtio-9p.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
hw/9pfs/virtio-9p.c +4 -0
@@ -231,6 +231,7 @@ v9fs_string_alloc_printf(char **strp, const char *fmt, va_list ap) arg_ulong = va_arg(ap2, unsigned long); len +=number_to_string ((void *)&arg_ulong,'U' ); }else { +va_end (ap2);return -1 ; }break ;
@@ -244,11 +245,14 @@ v9fs_string_alloc_printf(char **strp, const char *fmt, va_list ap)default :fprintf (stderr,"v9fs_string_alloc_printf:Incorrect format %c" , *iter); +va_end (ap2);return -1 ; } iter++; } +va_end (ap2); + alloc_print: *strp =g_malloc ((len +1 ) *sizeof (**strp));
Signature · 1 line
1.7.6.4
PATCH 1/2 sysbus: Supply missing va_end()
In reply to Markus ArmbrusterC99 7.15.1: Each invocation of the va_start and va_copy macros shall be matched by a corresponding invocation of the va_end macro in the same function.
Spotted by Coverity. Harmless on the (common) systems where va_end() does nothing.
--- hw/sysbus.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
hw/sysbus.c +2 -0
@@ -198,6 +198,7 @@ DeviceState *sysbus_create_varargs(const char *name,sysbus_connect_irq (s, n, irq); n++; } +va_end (va);return dev; }
@@ -229,6 +230,7 @@ DeviceState *sysbus_try_create_varargs(const char *name,sysbus_connect_irq (s, n, irq); n++; } +va_end (va);return dev; }
Signature · 1 line
1.7.6.4
Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] hw/9pfs: Supply missing va_end()
In reply to Markus ArmbrusterQuoted 11 lines · Markus Armbruster
C99 7.15.1: Each invocation of the
va_startandva_copymacros shall be matched by a corresponding invocation of theva_endmacro in the same function.Spotted by Coverity. Harmless on the (common) systems where
va_end()does nothing.Signed-off-by Markus Armbruster <[email protected]>---
hw/9pfs/virtio-9p.c | 4 ++++1 files changed, 4 insertions(+), 0 deletions(-)
Thanks for this patch. I looked at the surrounding code and it turns out this entire function duplicates g_vasprintf() from glib.
I sent a patch to use g_vasprintf() and it therefore eliminates the varargs issue.
Stefan
Stefan Hajnoczi
AppliedRe: [Qemu-devel] [PATCH 1/2] sysbus: Supply missing va_end()
In reply to Markus ArmbrusterQuoted 11 lines · Markus Armbruster
C99 7.15.1: Each invocation of the
va_startandva_copymacros shall be matched by a corresponding invocation of theva_endmacro in the same function.Spotted by Coverity. Harmless on the (common) systems where
va_end()does nothing.Signed-off-by Markus Armbruster <[email protected]>--- hw/sysbus.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
Thanks, applied to the trivial patches -next tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches-next
Stefan