diff options
| author | Andrii Nakryiko <andrii@kernel.org> | 2023-03-08 21:40:14 -0800 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2023-03-10 08:14:08 -0800 |
| commit | c8ed66859397237c649998c58a68a86b8ea5f417 (patch) | |
| tree | 9c13a073b663a889dcc205bceebbbbf49c0493fd /tools/testing/selftests/bpf/progs/linked_funcs2.c | |
| parent | 713461b895ef958ef444b00cc2d979f3ca3a82e2 (diff) | |
selftests/bpf: fix lots of silly mistakes pointed out by compiler
Once we enable -Wall for BPF sources, compiler will complain about lots
of unused variables, variables that are set but never read, etc.
Fix all these issues first before enabling -Wall in Makefile.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20230309054015.4068562-4-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/linked_funcs2.c')
| -rw-r--r-- | tools/testing/selftests/bpf/progs/linked_funcs2.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/linked_funcs2.c b/tools/testing/selftests/bpf/progs/linked_funcs2.c index ee7e3848ee4f..013ff0645f0c 100644 --- a/tools/testing/selftests/bpf/progs/linked_funcs2.c +++ b/tools/testing/selftests/bpf/progs/linked_funcs2.c @@ -5,6 +5,7 @@ #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> +#include "bpf_misc.h" /* weak and shared between both files */ const volatile int my_tid __weak; @@ -51,6 +52,7 @@ __weak int set_output_weak(int x) * cause problems for BPF static linker */ whatever = 2 * bpf_core_type_size(struct task_struct); + __sink(whatever); output_weak2 = x; return 2 * x; @@ -71,6 +73,7 @@ int BPF_PROG(handler2, struct pt_regs *regs, long id) /* make sure we have CO-RE relocations in main program */ whatever = bpf_core_type_size(struct task_struct); + __sink(whatever); set_output_val1(2000); set_output_ctx1(ctx); /* ctx definition is hidden in BPF_PROG macro */ |