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é <phi...@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 >