lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8a713266-777f-099c-2eed-7ac13b7b72a6@oracle.com>
Date:   Wed, 22 Nov 2023 16:44:16 +0000
From:   Alan Maguire <alan.maguire@...cle.com>
To:     Ben Dooks <ben.dooks@...ethink.co.uk>, bpf@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bpf: add __printf() to for printf fmt strings

On 22/11/2023 13:36, Ben Dooks wrote:
> The btf_seq_show() and btf_snprintf_show() take a printk format
> string so add a __printf() to these two functions. This fixes the
> following extended warnings:
> 
> kernel/bpf/btf.c:7094:29: error: function ‘btf_seq_show’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
> kernel/bpf/btf.c:7131:9: error: function ‘btf_snprintf_show’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
> 
> Signed-off-by: Ben Dooks <ben.dooks@...ethink.co.uk>

Looks good to me, thanks for fixing! Could also add a

Fixes: eb411377aed9 ("bpf: Add bpf_seq_printf_btf helper")

Reviewed-by: Alan Maguire <alan.maguire@...cle.com>

> ---
>  kernel/bpf/btf.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 15d71d2986d3..46c2e87c383d 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -7088,8 +7088,8 @@ static void btf_type_show(const struct btf *btf, u32 type_id, void *obj,
>  	btf_type_ops(t)->show(btf, t, type_id, obj, 0, show);
>  }
>  
> -static void btf_seq_show(struct btf_show *show, const char *fmt,
> -			 va_list args)
> +static __printf(2,0) void btf_seq_show(struct btf_show *show, const char *fmt,
> +				       va_list args)
>  {
>  	seq_vprintf((struct seq_file *)show->target, fmt, args);
>  }
> @@ -7122,7 +7122,7 @@ struct btf_show_snprintf {
>  	int len;		/* length we would have written */
>  };
>  
> -static void btf_snprintf_show(struct btf_show *show, const char *fmt,
> +static __printf(2,0) void btf_snprintf_show(struct btf_show *show, const char *fmt,
>  			      va_list args)
>  {
>  	struct btf_show_snprintf *ssnprintf = (struct btf_show_snprintf *)show;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ