* [PATCH] [v2] bpf: add printf attributes
@ 2026-09-15 21:30 Arnd Bergmann
2026-09-21 21:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2026-09-15 21:30 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Eduard Zingerman, Kumar Kartikeya Dwivedi
Cc: Arnd Bergmann, Martin KaFai Lau, Song Liu, Yonghong Song,
Jiri Olsa, Emil Tsalapatis, Ihor Solodrai, Amery Hung, Kees Cook,
bpf, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Building with extra warnings enabled shows a missing printf attribute:
kernel/bpf/diagnostics.c: In function 'bpf_diag_source':
kernel/bpf/diagnostics.c:828:9: error: function 'bpf_diag_source' might be a candidate for 'gnu_printf' format attribute [-Werror=suggest-attribute=format]
828 | msg = bpf_diag_vfmt(env, fmt, args);
Add these to shut up the warning and allow the compiler to check the
format strings.
Fixes: b9c5d822f677 ("bpf: Add source and instruction diagnostic context")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2 changes:
- only change the one function that needs it
- fix line wrapping
- use correct Fixes tag
---
kernel/bpf/diagnostics.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/diagnostics.c b/kernel/bpf/diagnostics.c
index a2cac59c6639..48ea3ac23b63 100644
--- a/kernel/bpf/diagnostics.c
+++ b/kernel/bpf/diagnostics.c
@@ -794,8 +794,9 @@ static void diag_print_insn_context(struct bpf_verifier_env *env, u32 insn_idx,
}
}
-static void bpf_diag_source(struct bpf_verifier_env *env, u32 insn_idx, const char *label,
- const char *fmt, ...)
+static __printf(4, 5) void bpf_diag_source(struct bpf_verifier_env *env,
+ u32 insn_idx, const char *label,
+ const char *fmt, ...)
{
struct bpf_diag_scratch *scratch;
struct bpf_linfo_source *source_lines;
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [v2] bpf: add printf attributes
2026-09-15 21:30 [PATCH] [v2] bpf: add printf attributes Arnd Bergmann
@ 2026-09-21 21:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-21 21:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: ast, daniel, andrii, eddyz87, memxor, arnd, martin.lau, song,
yonghong.song, jolsa, emil, ihor.solodrai, ameryhung,
kees+treewide, bpf, linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Tue, 15 Sep 2026 23:30:09 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Building with extra warnings enabled shows a missing printf attribute:
>
> kernel/bpf/diagnostics.c: In function 'bpf_diag_source':
> kernel/bpf/diagnostics.c:828:9: error: function 'bpf_diag_source' might be a candidate for 'gnu_printf' format attribute [-Werror=suggest-attribute=format]
> 828 | msg = bpf_diag_vfmt(env, fmt, args);
>
> [...]
Here is the summary with links:
- [v2] bpf: add printf attributes
https://git.kernel.org/bpf/bpf-next/c/7f2b0b57a8d7
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:[~2026-09-21 22:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 21:30 [PATCH] [v2] bpf: add printf attributes Arnd Bergmann
2026-09-21 21:20 ` 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
all inboxes | Powered by JetHome®