Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/ctcm: add __printf format attribute to ctcm_dbf_longtext

Allow the compiler to recognize and check format strings and parameters.

As reported with allmodconfig and W=1:

drivers/s390/net/ctcm_dbug.c: In function ‘ctcm_dbf_longtext’:
drivers/s390/net/ctcm_dbug.c:73:9: error: function ‘ctcm_dbf_longtext’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
73 | vsnprintf(dbf_txt_buf, sizeof(dbf_txt_buf), fmt, args);
| ^~~~~~~~~

Acked-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Heiko Carstens and committed by
David S. Miller
dddbf913 9961d6d5

+1
+1
drivers/s390/net/ctcm_dbug.h
··· 65 65 66 66 int ctcm_register_dbf_views(void); 67 67 void ctcm_unregister_dbf_views(void); 68 + __printf(3, 4) 68 69 void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *text, ...); 69 70 70 71 static inline const char *strtail(const char *s, int n)