Skip to contentSkip to conversation

printk: use gnu_printf format attribute for printk_sprint()

PATCH In review John Ogness 2 participants 2 messages Sep 27, 2021 – Oct 4, 2021 Printk

lore
Share & tools
lore

John Ogness

author maintainer
#0 lore raw

PATCH 1/1 printk: use gnu_printf format attribute for printk_sprint()

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]

---
 kernel/printk/printk.c | 1 +
 1 file changed, 1 insertion(+)
kernel/printk/printk.c +1 -0
index 4d6dea5d7c1c..d617987f5785 100644
@@ -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)

base-commit: 9980c4251f8ddfcf0617ed5724e4df5bd1f69c85

Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 8 lines · John Ogness

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]

The patch has been committed into printk/linux.git, branch for-5.16.

Best Regards,
Petr