Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1647036
| From | Petr Mladek <pmladek@suse.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/1] printk: add __printf attributes to internal functions |
| Date | 2017-05-22 17:30 +0200 |
| Message-ID | <tJXrr-7oA-9@gated-at.bofh.it> (permalink) |
| References | <tJ8Ih-7FO-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat 2017-05-20 11:18:53, Nicolas Iooss wrote:
> 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 <nicolas.iooss_linux@m4x.org>
> ---
> kernel/printk/printk_safe.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c
> index 033e50a7d706..2e27a31941f4 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)
There is one more variant of this function used when CONFIG_PRINTK_NMI
is not defined. Feel free to send updated patch as a reply. Or I could
add this trivial change when pushing this patch to printk.git if nobody
complains.
Otherwise, the patch looks fine to me. Therefore with patching the other
vprintk_nmi() variant:
Acked-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/1] printk: add __printf attributes to internal functions Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2017-05-20 11:20 +0200
Re: [PATCH 1/1] printk: add __printf attributes to internal functions Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-05-22 04:50 +0200
Re: [PATCH 1/1] printk: add __printf attributes to internal functions Petr Mladek <pmladek@suse.com> - 2017-05-22 17:30 +0200
[PATCH v2 1/1] printk: add __printf attributes to internal functions Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2017-05-24 08:00 +0200
csiph-web