Skip to content

Commit 1d2d941

Browse files
olsajiriMartin KaFai Lau
authored andcommitted
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: b3e1331 ("selftests/bpf: Test parameterized task BPF iterators.") Cc: Kui-Feng Lee <[email protected]> Signed-off-by: Jiri Olsa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
1 parent 8206e4e commit 1d2d941

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tools/testing/selftests/bpf/prog_tests/bpf_iter.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,6 @@ static noinline int trigger_func(int arg)
14981498
static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool one_proc)
14991499
{
15001500
struct bpf_iter_vma_offset *skel;
1501-
struct bpf_link *link;
15021501
char buf[16] = {};
15031502
int iter_fd, len;
15041503
int pgsz, shift;
@@ -1513,11 +1512,11 @@ static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool
15131512
;
15141513
skel->bss->page_shift = shift;
15151514

1516-
link = bpf_program__attach_iter(skel->progs.get_vma_offset, opts);
1517-
if (!ASSERT_OK_PTR(link, "attach_iter"))
1518-
return;
1515+
skel->links.get_vma_offset = bpf_program__attach_iter(skel->progs.get_vma_offset, opts);
1516+
if (!ASSERT_OK_PTR(skel->links.get_vma_offset, "attach_iter"))
1517+
goto exit;
15191518

1520-
iter_fd = bpf_iter_create(bpf_link__fd(link));
1519+
iter_fd = bpf_iter_create(bpf_link__fd(skel->links.get_vma_offset));
15211520
if (!ASSERT_GT(iter_fd, 0, "create_iter"))
15221521
goto exit;
15231522

@@ -1535,7 +1534,7 @@ static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool
15351534
close(iter_fd);
15361535

15371536
exit:
1538-
bpf_link__destroy(link);
1537+
bpf_iter_vma_offset__destroy(skel);
15391538
}
15401539

15411540
static void test_task_vma_offset(void)

0 commit comments

Comments
 (0)