* [PATCH bpf-next] bpf: eliminate remaining "make W=1" warnings in kernel/bpf/btf.o
@ 2024-07-12 9:28 Alan Maguire
2024-07-12 15:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Alan Maguire @ 2024-07-12 9:28 UTC (permalink / raw)
To: martin.lau
Cc: ast, daniel, andrii, eddyz87, song, yonghong.song, john.fastabend,
kpsingh, sdf, haoluo, jolsa, bpf, Alan Maguire, Mirsad Todorovac
As reported by Mirsad [1] we still see format warnings in kernel/bpf/btf.o
at W=1 warning level:
CC kernel/bpf/btf.o
./kernel/bpf/btf.c: In function ‘btf_type_seq_show_flags’:
./kernel/bpf/btf.c:7553:21: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
7553 | sseq.showfn = btf_seq_show;
| ^
./kernel/bpf/btf.c: In function ‘btf_type_snprintf_show’:
./kernel/bpf/btf.c:7604:31: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
7604 | ssnprintf.show.showfn = btf_snprintf_show;
| ^
Combined with CONFIG_WERROR=y these can halt the build.
The fix (annotating the structure field with __printf())
suggested by Mirsad resolves these. Apologies I missed this last time.
No other W=1 warnings were observed in kernel/bpf after this fix.
[1] https://lore.kernel.org/bpf/92c9d047-f058-400c-9c7d-81d4dc1ef71b@gmail.com/
Fixes: b3470da314fd ("bpf: annotate BTF show functions with __printf")
Suggested-by: Mirsad Todorovac <mtodorovac69@gmail.com>
Reported-by: Mirsad Todorovac <mtodorovac69@gmail.com>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
kernel/bpf/btf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index d5019c4454d6..520f49f422fe 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -415,7 +415,7 @@ const char *btf_type_str(const struct btf_type *t)
struct btf_show {
u64 flags;
void *target; /* target of show operation (seq file, buffer) */
- void (*showfn)(struct btf_show *show, const char *fmt, va_list args);
+ __printf(2, 0) void (*showfn)(struct btf_show *show, const char *fmt, va_list args);
const struct btf *btf;
/* below are used during iteration */
struct {
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH bpf-next] bpf: eliminate remaining "make W=1" warnings in kernel/bpf/btf.o
2024-07-12 9:28 [PATCH bpf-next] bpf: eliminate remaining "make W=1" warnings in kernel/bpf/btf.o Alan Maguire
@ 2024-07-12 15:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-12 15:10 UTC (permalink / raw)
To: Alan Maguire
Cc: martin.lau, ast, daniel, andrii, eddyz87, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, bpf, mtodorovac69
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Fri, 12 Jul 2024 10:28:59 +0100 you wrote:
> As reported by Mirsad [1] we still see format warnings in kernel/bpf/btf.o
> at W=1 warning level:
>
> CC kernel/bpf/btf.o
> ./kernel/bpf/btf.c: In function ‘btf_type_seq_show_flags’:
> ./kernel/bpf/btf.c:7553:21: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
> 7553 | sseq.showfn = btf_seq_show;
> | ^
> ./kernel/bpf/btf.c: In function ‘btf_type_snprintf_show’:
> ./kernel/bpf/btf.c:7604:31: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
> 7604 | ssnprintf.show.showfn = btf_snprintf_show;
> | ^
>
> [...]
Here is the summary with links:
- [bpf-next] bpf: eliminate remaining "make W=1" warnings in kernel/bpf/btf.o
https://git.kernel.org/bpf/bpf-next/c/2454075f8e29
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-12 15:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-12 9:28 [PATCH bpf-next] bpf: eliminate remaining "make W=1" warnings in kernel/bpf/btf.o Alan Maguire
2024-07-12 15:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox