Re: [Qemu-devel] [PATCH] jazz_led: fix bad snprintf

2017-05-05 Thread Michael Tokarev
03.05.2017 13:44, Paolo Bonzini wrote: > Detected by GCC 7's -Wformat-truncation. snprintf writes at most > 2 bytes here including the terminating NUL, so the result is > truncated. In addition, the newline at the end is pointless. > Fix the buffer size and the format string. Applied to -trivial

Re: [Qemu-devel] [PATCH] jazz_led: fix bad snprintf

2017-05-05 Thread Paolo Bonzini
On 05/05/2017 08:24, Michael Tokarev wrote: > 03.05.2017 13:44, Paolo Bonzini wrote: >> Detected by GCC 7's -Wformat-truncation. snprintf writes at most >> 2 bytes here including the terminating NUL, so the result is >> truncated. In addition, the newline at the end is pointless. >> Fix the buf

Re: [Qemu-devel] [PATCH] jazz_led: fix bad snprintf

2017-05-04 Thread Michael Tokarev
03.05.2017 13:44, Paolo Bonzini wrote: > Detected by GCC 7's -Wformat-truncation. snprintf writes at most > 2 bytes here including the terminating NUL, so the result is > truncated. In addition, the newline at the end is pointless. > Fix the buffer size and the format string. Polo, that's quite

Re: [Qemu-devel] [PATCH] jazz_led: fix bad snprintf

2017-05-03 Thread Markus Armbruster
Paolo Bonzini writes: > On 03/05/2017 14:56, Markus Armbruster wrote: >>> snprintf writes at most 2 bytes here including the terminating NUL, so >>> the result is truncated". >> >> You're right; I forgot that snprintf() always adds a NUL. So this *is* >> broken: we write NUL instead of the secon

Re: [Qemu-devel] [PATCH] jazz_led: fix bad snprintf

2017-05-03 Thread Paolo Bonzini
On 03/05/2017 14:56, Markus Armbruster wrote: >> snprintf writes at most 2 bytes here including the terminating NUL, so >> the result is truncated". > > You're right; I forgot that snprintf() always adds a NUL. So this *is* > broken: we write NUL instead of the second digit. Mentioning this in

Re: [Qemu-devel] [PATCH] jazz_led: fix bad snprintf

2017-05-03 Thread Markus Armbruster
Paolo Bonzini writes: > On 03/05/2017 13:38, Markus Armbruster wrote: >> Paolo Bonzini writes: >> >>> Detected by GCC 7's -Wformat-truncation. snprintf writes at most >>> 2 bytes here including the terminating NUL, so the result is >>> truncated. In addition, the newline at the end is pointle

Re: [Qemu-devel] [PATCH] jazz_led: fix bad snprintf

2017-05-03 Thread Paolo Bonzini
On 03/05/2017 13:38, Markus Armbruster wrote: > Paolo Bonzini writes: > >> Detected by GCC 7's -Wformat-truncation. snprintf writes at most >> 2 bytes here including the terminating NUL, so the result is >> truncated. In addition, the newline at the end is pointless. >> Fix the buffer size an

Re: [Qemu-devel] [PATCH] jazz_led: fix bad snprintf

2017-05-03 Thread Markus Armbruster
Paolo Bonzini writes: > Detected by GCC 7's -Wformat-truncation. snprintf writes at most > 2 bytes here including the terminating NUL, so the result is > truncated. In addition, the newline at the end is pointless. > Fix the buffer size and the format string. > --- > hw/display/jazz_led.c | 4

[Qemu-devel] [PATCH] jazz_led: fix bad snprintf

2017-05-03 Thread Paolo Bonzini
Detected by GCC 7's -Wformat-truncation. snprintf writes at most 2 bytes here including the terminating NUL, so the result is truncated. In addition, the newline at the end is pointless. Fix the buffer size and the format string. --- hw/display/jazz_led.c | 4 ++-- 1 file changed, 2 insertions(+