[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 4/4] qapi/error: Check format string argument in error_*prepen
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PULL 4/4] qapi/error: Check format string argument in error_*prepend() |
Date: |
Fri, 24 Jul 2020 17:06:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 7/24/20 4:08 PM, Daniel P. Berrangé wrote:
> On Fri, Jul 24, 2020 at 03:47:04PM +0200, Markus Armbruster wrote:
>> From: Philippe Mathieu-Daudé <philmd@redhat.com>
>>
>> error_propagate_prepend() "behaves like error_prepend()", and
>> error_prepend() uses "formatting @fmt, ... like printf()".
>> error_prepend() checks its format string argument, but
>> error_propagate_prepend() does not. Fix by addint the format
>> attribute to error_propagate_prepend() and error_vprepend().
>>
>> This would have caught the bug fixed in the previous commit.
>>
>> Missed in commit 4b5766488f "error: Fix use of error_prepend() with
>> &error_fatal, &error_abort".
>
> FWIW, I'd suggest a followup patch that adds -Wsuggest-attribute=format
> to CFLAGS, as after a quick hack to try a build, I think all the things
> it reports are valid cases needing the format attribute.
>
> qemu/util/error.c:62:5: warning: function ‘error_setv’ might be a candidate
> for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> qemu/util/error.c:133:5: warning: function ‘error_vprepend’ might be a
> candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> qemu/util/qemu-error.c:236:5: warning: function ‘vreport’ might be a
> candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> qemu/contrib/libvhost-user/libvhost-user.c:161:5: warning: function
> ‘vu_panic’ might be a candidate for ‘gnu_printf’ format attribute
> [-Wsuggest-attribute=format]
> qemu/tools/virtiofsd/fuse_log.c:20:5: warning: function ‘default_log_func’
> might be a candidate for ‘gnu_printf’ format attribute
> [-Wsuggest-attribute=format]
> qemu/tools/virtiofsd/passthrough_ll.c:2752:9: warning: function ‘log_func’
> might be a candidate for ‘gnu_printf’ format attribute
> [-Wsuggest-attribute=format]
> qemu/tools/virtiofsd/passthrough_ll.c:2754:9: warning: function ‘log_func’
> might be a candidate for ‘gnu_printf’ format attribute
> [-Wsuggest-attribute=format]
> qemu/hw/xen/xen-bus-helper.c:124:9: warning: function ‘xs_node_vscanf’ might
> be a candidate for ‘gnu_scanf’ format attribute [-Wsuggest-attribute=format]
> qemu/disas.c:497:5: warning: function ‘plugin_printf’ might be a candidate
> for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
I have the printf() ones ready but am waiting to be closer to 5.2.
>
>
> Regards,
> Daniel
>
- [PULL 0/4] Error reporting patches patches for 2020-07-24, Markus Armbruster, 2020/07/24
- [PULL 1/4] coccinelle/err-bad-newline: Fix for Python 3, and add patterns, Markus Armbruster, 2020/07/24
- [PULL 4/4] qapi/error: Check format string argument in error_*prepend(), Markus Armbruster, 2020/07/24
- [PULL 3/4] sd/milkymist-memcard: Fix format string, Markus Armbruster, 2020/07/24
- [PULL 2/4] error: Strip trailing '\n' from error string arguments (again), Markus Armbruster, 2020/07/24
- Re: [PULL 0/4] Error reporting patches patches for 2020-07-24, Peter Maydell, 2020/07/25