Skip to content

Commit

Permalink
selftests/bpf: Fix error checking for cpumask_success__load()
Browse files Browse the repository at this point in the history
We should verify the return value of cpumask_success__load().

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: David Vernet <void@manifault.com>
  • Loading branch information
laoar authored and intel-lab-lkp committed Jan 31, 2024
1 parent b8a6bb2 commit 92f80f2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/testing/selftests/bpf/prog_tests/cpumask.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static void verify_success(const char *prog_name)
struct bpf_program *prog;
struct bpf_link *link = NULL;
pid_t child_pid;
int status;
int status, err;

skel = cpumask_success__open();
if (!ASSERT_OK_PTR(skel, "cpumask_success__open"))
Expand All @@ -36,8 +36,8 @@ static void verify_success(const char *prog_name)
skel->bss->pid = getpid();
skel->bss->nr_cpus = libbpf_num_possible_cpus();

cpumask_success__load(skel);
if (!ASSERT_OK_PTR(skel, "cpumask_success__load"))
err = cpumask_success__load(skel);
if (!ASSERT_OK(err, "cpumask_success__load"))
goto cleanup;

prog = bpf_object__find_program_by_name(skel->obj, prog_name);
Expand Down

0 comments on commit 92f80f2

Please sign in to comment.