printk: use gnu_printf format attribute for printk_sprint()
authorJohn Ogness <john.ogness@linutronix.de>
Mon, 27 Sep 2021 14:22:03 +0000 (16:28 +0206)
committerPetr Mladek <pmladek@suse.com>
Mon, 4 Oct 2021 08:35:13 +0000 (10:35 +0200)
Fix the following W=1 kernel build warning:

kernel/printk/printk.c: In function 'printk_sprint':
kernel/printk/printk.c:1913:9: warning: function 'printk_sprint' might be
a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210927142203.124730-1-john.ogness@linutronix.de
kernel/printk/printk.c

index 4d6dea5d7c1c7bd43079999c2b6bc4749fb7c5f6..d617987f57854281a8edb4c56a33925e2c43ac93 100644 (file)
@@ -2066,6 +2066,7 @@ u16 printk_parse_prefix(const char *text, int *level,
        return prefix_len;
 }
 
+__printf(5, 0)
 static u16 printk_sprint(char *text, u16 size, int facility,
                         enum printk_info_flags *flags, const char *fmt,
                         va_list args)