diff options
author | Lorenz Bauer <lmb@cloudflare.com> | 2019-05-08 17:49:32 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-05-09 15:53:56 -0700 |
commit | 07b619919d3d5401adc9bc6b79dcf12cc2c6d485 (patch) | |
tree | 7592791ba5b9f6bd2dbdb17b0537f4eb0df23b43 /tools/testing/selftests/bpf/prog_tests/tp_attach_query.c | |
parent | 494bc1d281b5a9f02a81249fa566d8c7e390c50c (diff) | |
download | linux-07b619919d3d5401adc9bc6b79dcf12cc2c6d485.tar.gz linux-07b619919d3d5401adc9bc6b79dcf12cc2c6d485.tar.bz2 linux-07b619919d3d5401adc9bc6b79dcf12cc2c6d485.zip |
selftests: bpf: initialize bpf_object pointers where needed
There are a few tests which call bpf_object__close on uninitialized
bpf_object*, which may segfault. Explicitly zero-initialise these pointers
to avoid this.
Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/tp_attach_query.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/tp_attach_query.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/tp_attach_query.c b/tools/testing/selftests/bpf/prog_tests/tp_attach_query.c index a2f476f91637..fb095e5cd9af 100644 --- a/tools/testing/selftests/bpf/prog_tests/tp_attach_query.c +++ b/tools/testing/selftests/bpf/prog_tests/tp_attach_query.c @@ -13,6 +13,9 @@ void test_tp_attach_query(void) struct bpf_prog_info prog_info; char buf[256]; + for (i = 0; i < num_progs; i++) + obj[i] = NULL; + snprintf(buf, sizeof(buf), "/sys/kernel/debug/tracing/events/sched/sched_switch/id"); efd = open(buf, O_RDONLY, 0); |