Skip to content

eBPF-based security platform

treewide: mark the btf_dump print callbacks __printf()

Daniel Borkmann4403dd5fedfa
diff --git a/tools/gen-vmlinux-h/gen-vmlinux-h.c b/tools/gen-vmlinux-h/gen-vmlinux-h.c
index 335228a2..8c93a4ab 100644
--- a/tools/gen-vmlinux-h/gen-vmlinux-h.c
+++ b/tools/gen-vmlinux-h/gen-vmlinux-h.c
@@ -25,6 +25,8 @@
#include <bpf/hashmap.h>
#include <bpf/libbpf.h>
+#include <shirudo/compiler.h>
+
#define KFUNC_DECL_TAG "bpf_kfunc"
#define FASTCALL_DECL_TAG "bpf_fastcall"
@@ -61,7 +63,7 @@ static int cmp_kfuncs(const void *pa, const void *pb, void *ctx)
btf__str_by_offset(btf, b->name_off));
}
-static void emit(void *ctx, const char *fmt, va_list args)
+static __printf(2, 0) void emit(void *ctx, const char *fmt, va_list args)
{
vprintf(fmt, args);
}
diff --git a/util/upatch_rodata.c b/util/upatch_rodata.c
index 48d30db4..f0aaf278 100644
--- a/util/upatch_rodata.c
+++ b/util/upatch_rodata.c
@@ -774,7 +774,8 @@ static int btf_var_type(const struct btf *btf,
return 0;
}
-static void print_text(void *ctx, const char *fmt, va_list args)
+static __printf(2, 0) void print_text(void *ctx, const char *fmt,
+ va_list args)
{
FILE *fp = ctx;