Skip to content

Commit

Permalink
selftests/bpf: Add missing bpf_iter_vma_offset__destroy call
Browse files Browse the repository at this point in the history
[ Upstream commit 1d2d941 ]

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 <kuifeng@fb.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20221006083106.117987-1-jolsa@kernel.org
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
olsajiri authored and gregkh committed Dec 31, 2022
1 parent cd58eb4 commit 49cafaa
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tools/testing/selftests/bpf/prog_tests/bpf_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct bpf_iter_vma_offset *skel;
struct bpf_link *link;
char buf[16] = {};
int iter_fd, len;
int pgsz, shift;
Expand All @@ -1513,11 +1512,11 @@ static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool
;
skel->bss->page_shift = shift;

link = bpf_program__attach_iter(skel->progs.get_vma_offset, opts);
if (!ASSERT_OK_PTR(link, "attach_iter"))
return;
skel->links.get_vma_offset = bpf_program__attach_iter(skel->progs.get_vma_offset, opts);
if (!ASSERT_OK_PTR(skel->links.get_vma_offset, "attach_iter"))
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"))
goto exit;

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

exit:
bpf_link__destroy(link);
bpf_iter_vma_offset__destroy(skel);
}

static void test_task_vma_offset(void)
Expand Down

0 comments on commit 49cafaa

Please sign in to comment.