Skip to content

Commit f4e981c

Browse files
fishilicopmladek
authored andcommitted
printk: add __printf attributes to internal functions
When compiling with -Wsuggest-attribute=format, gcc complains that some functions in kernel/printk/printk_safe.c transmit their argument to printf-like functions without having a printf attribute. Silence these warnings by adding relevant __printf attributes. Link: http://lkml.kernel.org/r/[email protected] Cc: Steven Rostedt <[email protected]> Cc: [email protected] Signed-off-by: Nicolas Iooss <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Petr Mladek <[email protected]>
1 parent 719f6a7 commit f4e981c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

kernel/printk/printk_safe.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ static void queue_flush_work(struct printk_safe_seq_buf *s)
8080
* happen, printk_safe_log_store() will notice the buffer->len mismatch
8181
* and repeat the write.
8282
*/
83-
static int printk_safe_log_store(struct printk_safe_seq_buf *s,
84-
const char *fmt, va_list args)
83+
static __printf(2, 0) int printk_safe_log_store(struct printk_safe_seq_buf *s,
84+
const char *fmt, va_list args)
8585
{
8686
int add;
8787
size_t len;
@@ -299,7 +299,7 @@ void printk_safe_flush_on_panic(void)
299299
* one writer running. But the buffer might get flushed from another
300300
* CPU, so we need to be careful.
301301
*/
302-
static int vprintk_nmi(const char *fmt, va_list args)
302+
static __printf(1, 0) int vprintk_nmi(const char *fmt, va_list args)
303303
{
304304
struct printk_safe_seq_buf *s = this_cpu_ptr(&nmi_print_seq);
305305

@@ -330,7 +330,7 @@ void printk_nmi_exit(void)
330330

331331
#else
332332

333-
static int vprintk_nmi(const char *fmt, va_list args)
333+
static __printf(1, 0) int vprintk_nmi(const char *fmt, va_list args)
334334
{
335335
return 0;
336336
}
@@ -342,7 +342,7 @@ static int vprintk_nmi(const char *fmt, va_list args)
342342
* into itself. It uses a per-CPU buffer to store the message, just like
343343
* NMI.
344344
*/
345-
static int vprintk_safe(const char *fmt, va_list args)
345+
static __printf(1, 0) int vprintk_safe(const char *fmt, va_list args)
346346
{
347347
struct printk_safe_seq_buf *s = this_cpu_ptr(&safe_print_seq);
348348

0 commit comments

Comments
 (0)