From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966203AbdEXF5K (ORCPT ); Wed, 24 May 2017 01:57:10 -0400 Received: from mx1.polytechnique.org ([129.104.30.34]:46701 "EHLO mx1.polytechnique.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937660AbdEXF5I (ORCPT ); Wed, 24 May 2017 01:57:08 -0400 X-Greylist: delayed 402 seconds by postgrey-1.27 at vger.kernel.org; Wed, 24 May 2017 01:57:08 EDT From: Nicolas Iooss To: Petr Mladek , Sergey Senozhatsky , Steven Rostedt Cc: linux-kernel@vger.kernel.org, Nicolas Iooss Subject: [PATCH v2 1/1] printk: add __printf attributes to internal functions Date: Wed, 24 May 2017 07:49:50 +0200 Message-Id: <20170524054950.6722-1-nicolas.iooss_linux@m4x.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170522152211.GF12489@pathway.suse.cz> References: <20170522152211.GF12489@pathway.suse.cz> X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Wed May 24 07:50:23 2017 +0200 (CEST)) X-Spam-Flag: No, tests=bogofilter, spamicity=0.000000, queueID=5727B5648FD Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Nicolas Iooss Acked-by: Petr Mladek --- v2: add __printf attribute to the definition of vprintk_nmi() which is used when CONFIG_PRINTK_NMI is not defined. kernel/printk/printk_safe.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c index 033e50a7d706..f96d1ecd85ac 100644 --- a/kernel/printk/printk_safe.c +++ b/kernel/printk/printk_safe.c @@ -80,8 +80,8 @@ static void queue_flush_work(struct printk_safe_seq_buf *s) * happen, printk_safe_log_store() will notice the buffer->len mismatch * and repeat the write. */ -static int printk_safe_log_store(struct printk_safe_seq_buf *s, - const char *fmt, va_list args) +static __printf(2, 0) int printk_safe_log_store(struct printk_safe_seq_buf *s, + const char *fmt, va_list args) { int add; size_t len; @@ -299,7 +299,7 @@ void printk_safe_flush_on_panic(void) * one writer running. But the buffer might get flushed from another * CPU, so we need to be careful. */ -static int vprintk_nmi(const char *fmt, va_list args) +static __printf(1, 0) int vprintk_nmi(const char *fmt, va_list args) { struct printk_safe_seq_buf *s = this_cpu_ptr(&nmi_print_seq); @@ -318,7 +318,7 @@ void printk_nmi_exit(void) #else -static int vprintk_nmi(const char *fmt, va_list args) +static __printf(1, 0) int vprintk_nmi(const char *fmt, va_list args) { return 0; } @@ -330,7 +330,7 @@ static int vprintk_nmi(const char *fmt, va_list args) * into itself. It uses a per-CPU buffer to store the message, just like * NMI. */ -static int vprintk_safe(const char *fmt, va_list args) +static __printf(1, 0) int vprintk_safe(const char *fmt, va_list args) { struct printk_safe_seq_buf *s = this_cpu_ptr(&safe_print_seq); -- 2.13.0