Commit 1d2d941b authored by Jiri Olsa's avatar Jiri Olsa Committed by Martin KaFai Lau

selftests/bpf: Add missing bpf_iter_vma_offset__destroy call

Adding missing bpf_iter_vma_offset__destroy call and using in-skeletin
link pointer so we don't need extra bpf_link__destroy call.

Fixes: b3e1331e ("selftests/bpf: Test parameterized task BPF iterators.")
Cc: Kui-Feng Lee <kuifeng@fb.com>
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20221006083106.117987-1-jolsa@kernel.orgSigned-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent 8206e4e9
...@@ -1498,7 +1498,6 @@ static noinline int trigger_func(int arg) ...@@ -1498,7 +1498,6 @@ static noinline int trigger_func(int arg)
static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool one_proc) static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool one_proc)
{ {
struct bpf_iter_vma_offset *skel; struct bpf_iter_vma_offset *skel;
struct bpf_link *link;
char buf[16] = {}; char buf[16] = {};
int iter_fd, len; int iter_fd, len;
int pgsz, shift; int pgsz, shift;
...@@ -1513,11 +1512,11 @@ static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool ...@@ -1513,11 +1512,11 @@ static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool
; ;
skel->bss->page_shift = shift; skel->bss->page_shift = shift;
link = bpf_program__attach_iter(skel->progs.get_vma_offset, opts); skel->links.get_vma_offset = bpf_program__attach_iter(skel->progs.get_vma_offset, opts);
if (!ASSERT_OK_PTR(link, "attach_iter")) if (!ASSERT_OK_PTR(skel->links.get_vma_offset, "attach_iter"))
return; goto exit;
iter_fd = bpf_iter_create(bpf_link__fd(link)); iter_fd = bpf_iter_create(bpf_link__fd(skel->links.get_vma_offset));
if (!ASSERT_GT(iter_fd, 0, "create_iter")) if (!ASSERT_GT(iter_fd, 0, "create_iter"))
goto exit; goto exit;
...@@ -1535,7 +1534,7 @@ static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool ...@@ -1535,7 +1534,7 @@ static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool
close(iter_fd); close(iter_fd);
exit: exit:
bpf_link__destroy(link); bpf_iter_vma_offset__destroy(skel);
} }
static void test_task_vma_offset(void) static void test_task_vma_offset(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment