Skip to contentSkip to conversation

bpf: add missing __printf attribute to bpf_diag_source

PATCH Superseded Li Ruijian 1 participant 2 messages Sep 16 BPF

lore
Share & tools
lore

Li Ruijian

author
#0 lore raw

PATCH 1/1 bpf: add missing __printf attribute to bpf_diag_source

W=1 builds fail on kernel/bpf/diagnostics.o with -Werror=suggest-attribute=format. bpf_diag_source() passes a printf-style format string to bpf_diag_vfmt(); mark it __printf(4, 5) like the other diagnostic helpers.

---
 kernel/bpf/diagnostics.c | 1 +
 1 file changed, 1 insertion(+)
kernel/bpf/diagnostics.c +1 -0
index 0abbbe177e31..2421f52eec14 100644
@@ -794,6 +794,7 @@ static void diag_print_insn_context(struct bpf_verifier_env *env, u32 insn_idx,
 	}
 }
 
+__printf(4, 5)
 static void bpf_diag_source(struct bpf_verifier_env *env, u32 insn_idx, const char *label,
 			    const char *fmt, ...)
 {
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v2 1/1 bpf: add missing __printf attribute to bpf_diag_source

W=1 builds fail on kernel/bpf/diagnostics.o with -Werror=suggest-attribute=format. bpf_diag_source() passes a printf-style format string to bpf_diag_vfmt(); mark it __printf(4, 5) like the other diagnostic helpers.

---
 kernel/bpf/diagnostics.c | 1 +
 1 file changed, 1 insertion(+)

v2:
- drop accidental Co-authored-by trailer from v1

kernel/bpf/diagnostics.c +1 -0
index 0abbbe177e31..2421f52eec14 100644
@@ -794,6 +794,7 @@ static void diag_print_insn_context(struct bpf_verifier_env *env, u32 insn_idx,
 	}
 }
 
+__printf(4, 5)
 static void bpf_diag_source(struct bpf_verifier_env *env, u32 insn_idx, const char *label,
 			    const char *fmt, ...)
 {
Signature · 1 line
2.43.0