| From a8d6a4d214c2dfcc8e8b2d2715ca414a014b6343 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Thu, 11 Jul 2024 19:23:21 +0100 |
| Subject: bpf: annotate BTF show functions with __printf |
| |
| From: Alan Maguire <alan.maguire@oracle.com> |
| |
| [ Upstream commit b3470da314fd8018ee237e382000c4154a942420 ] |
| |
| -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: 31d0bc81637d ("bpf: Move to generic BTF show support, apply it to seq files/strings") |
| Reported-by: Mirsad Todorovac <mtodorovac69@gmail.com> |
| Signed-off-by: Alan Maguire <alan.maguire@oracle.com> |
| Tested-by: Mirsad Todorovac <mtodorovac69@yahoo.com> |
| Link: https://lore.kernel.org/r/20240711182321.963667-1-alan.maguire@oracle.com |
| Signed-off-by: Alexei Starovoitov <ast@kernel.org> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| kernel/bpf/btf.c | 8 ++++---- |
| 1 file changed, 4 insertions(+), 4 deletions(-) |
| |
| diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c |
| index a0c7e13e0ab4d..0c9d93e2c18f0 100644 |
| --- a/kernel/bpf/btf.c |
| +++ b/kernel/bpf/btf.c |
| @@ -5808,8 +5808,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) |
| +__printf(2, 0) static void btf_seq_show(struct btf_show *show, const char *fmt, |
| + va_list args) |
| { |
| seq_vprintf((struct seq_file *)show->target, fmt, args); |
| } |
| @@ -5842,8 +5842,8 @@ struct btf_show_snprintf { |
| int len; /* length we would have written */ |
| }; |
| |
| -static void btf_snprintf_show(struct btf_show *show, const char *fmt, |
| - va_list args) |
| +__printf(2, 0) static void btf_snprintf_show(struct btf_show *show, const char *fmt, |
| + va_list args) |
| { |
| struct btf_show_snprintf *ssnprintf = (struct btf_show_snprintf *)show; |
| int len; |
| -- |
| 2.43.0 |
| |