Commit a2bff65c authored by Yafang Shao's avatar Yafang Shao Committed by Andrii Nakryiko

selftests/bpf: Fix error checking for cpumask_success__load()

We should verify the return value of cpumask_success__load().
Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Acked-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240206081416.26242-4-laoar.shao@gmail.com
parent abae1ac5
...@@ -27,7 +27,7 @@ static void verify_success(const char *prog_name) ...@@ -27,7 +27,7 @@ static void verify_success(const char *prog_name)
struct bpf_program *prog; struct bpf_program *prog;
struct bpf_link *link = NULL; struct bpf_link *link = NULL;
pid_t child_pid; pid_t child_pid;
int status; int status, err;
skel = cpumask_success__open(); skel = cpumask_success__open();
if (!ASSERT_OK_PTR(skel, "cpumask_success__open")) if (!ASSERT_OK_PTR(skel, "cpumask_success__open"))
...@@ -36,8 +36,8 @@ static void verify_success(const char *prog_name) ...@@ -36,8 +36,8 @@ static void verify_success(const char *prog_name)
skel->bss->pid = getpid(); skel->bss->pid = getpid();
skel->bss->nr_cpus = libbpf_num_possible_cpus(); skel->bss->nr_cpus = libbpf_num_possible_cpus();
cpumask_success__load(skel); err = cpumask_success__load(skel);
if (!ASSERT_OK_PTR(skel, "cpumask_success__load")) if (!ASSERT_OK(err, "cpumask_success__load"))
goto cleanup; goto cleanup;
prog = bpf_object__find_program_by_name(skel->obj, prog_name); prog = bpf_object__find_program_by_name(skel->obj, prog_name);
......
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