summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2022-07-06 01:48:17 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2022-07-06 17:46:14 +0300
commitc46a12200114ae5ad7b0922e6c8969a22c3afbd7 (patch)
tree3f9d9fc7c447eb0329273f9278a54f88c075d8c2 /tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
parent645d5d3bc001a7d77459cb8360c36a60954d6008 (diff)
downloadlinux-c46a12200114ae5ad7b0922e6c8969a22c3afbd7.tar.xz
selftests/bpf: Fix few more compiler warnings
When compiling with -O2, GCC detects few problems with selftests/bpf, so fix all of them. Two are real issues (uninitialized err and nums out-of-bounds access), but two other uninitialized variables warnings are due to GCC not being able to prove that variables are indeed initialized under conditions under which they are used. Fix all 4 cases, though. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Yonghong Song <yhs@fb.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/bpf/20220705224818.4026623-3-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
index 586dc52d6fb9..a8cb8a96ddaf 100644
--- a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
+++ b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
@@ -329,7 +329,7 @@ static int get_syms(char ***symsp, size_t *cntp)
struct hashmap *map;
char buf[256];
FILE *f;
- int err;
+ int err = 0;
/*
* The available_filter_functions contains many duplicates,
@@ -404,7 +404,7 @@ static void test_bench_attach(void)
double attach_delta, detach_delta;
struct bpf_link *link = NULL;
char **syms = NULL;
- size_t cnt, i;
+ size_t cnt = 0, i;
if (!ASSERT_OK(get_syms(&syms, &cnt), "get_syms"))
return;