]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
seq_buf: Mark binary printing functions with __printf() attribute
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 21 Mar 2025 14:40:47 +0000 (16:40 +0200)
committerPetr Mladek <pmladek@suse.com>
Fri, 28 Mar 2025 12:37:11 +0000 (13:37 +0100)
Binary printing functions are using printf() type of format, and compiler
is not happy about them as is:

lib/seq_buf.c:162:17: error: function ‘seq_buf_bprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]

Fix the compilation errors by adding __printf() attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20250321144822.324050-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
include/linux/seq_buf.h

index fe41da0059700432044c1260952073914f7a26fc..52791e0705063ec646c51824a2bbb2408b093fde 100644 (file)
@@ -167,8 +167,8 @@ extern int seq_buf_hex_dump(struct seq_buf *s, const char *prefix_str,
                            const void *buf, size_t len, bool ascii);
 
 #ifdef CONFIG_BINARY_PRINTF
-extern int
-seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary);
+__printf(2, 0)
+int seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary);
 #endif
 
 void seq_buf_do_printk(struct seq_buf *s, const char *lvl);