Commit b3470da3 authored by Alan Maguire's avatar Alan Maguire Committed by Alexei Starovoitov

bpf: annotate BTF show functions with __printf

-Werror=suggest-attribute=format warns about two functions
in kernel/bpf/btf.c [1]; add __printf() annotations to silence
these warnings since for CONFIG_WERROR=y they will trigger
build failures.

[1] https://lore.kernel.org/bpf/a8b20c72-6631-4404-9e1f-0410642d7d20@gmail.com/

Fixes: 31d0bc81 ("bpf: Move to generic BTF show support, apply it to seq files/strings")
Reported-by: default avatarMirsad Todorovac <mtodorovac69@gmail.com>
Signed-off-by: default avatarAlan Maguire <alan.maguire@oracle.com>
Tested-by: default avatarMirsad Todorovac <mtodorovac69@yahoo.com>
Link: https://lore.kernel.org/r/20240711182321.963667-1-alan.maguire@oracle.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 19d3c179
...@@ -7538,7 +7538,7 @@ static void btf_type_show(const struct btf *btf, u32 type_id, void *obj, ...@@ -7538,7 +7538,7 @@ 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); btf_type_ops(t)->show(btf, t, type_id, obj, 0, show);
} }
static void btf_seq_show(struct btf_show *show, const char *fmt, __printf(2, 0) static void btf_seq_show(struct btf_show *show, const char *fmt,
va_list args) va_list args)
{ {
seq_vprintf((struct seq_file *)show->target, fmt, args); seq_vprintf((struct seq_file *)show->target, fmt, args);
...@@ -7572,7 +7572,7 @@ struct btf_show_snprintf { ...@@ -7572,7 +7572,7 @@ struct btf_show_snprintf {
int len; /* length we would have written */ int len; /* length we would have written */
}; };
static void btf_snprintf_show(struct btf_show *show, const char *fmt, __printf(2, 0) static void btf_snprintf_show(struct btf_show *show, const char *fmt,
va_list args) va_list args)
{ {
struct btf_show_snprintf *ssnprintf = (struct btf_show_snprintf *)show; struct btf_show_snprintf *ssnprintf = (struct btf_show_snprintf *)show;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment