summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_sysctl.c
diff options
context:
space:
mode:
authorArtem Savkov <asavkov@redhat.com>2022-04-21 15:01:04 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2022-04-21 16:34:55 +0200
commit920fd5e1771db8b338d4145c2d30d60bf0bcce99 (patch)
tree020352f368979bfde1c743492799e0da57e8e428 /tools/testing/selftests/bpf/test_sysctl.c
parenti40e, xsk: Get rid of redundant 'fallthrough' (diff)
downloadlinux-920fd5e1771db8b338d4145c2d30d60bf0bcce99.tar.xz
linux-920fd5e1771db8b338d4145c2d30d60bf0bcce99.zip
selftests/bpf: Fix attach tests retcode checks
Switching to libbpf 1.0 API broke test_sock and test_sysctl as they check for return of bpf_prog_attach to be exactly -1. Switch the check to '< 0' instead. Fixes: b858ba8c52b6 ("selftests/bpf: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK") Signed-off-by: Artem Savkov <asavkov@redhat.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Yafang Shao <laoar.shao@gmail.com> Link: https://lore.kernel.org/bpf/20220421130104.1582053-1-asavkov@redhat.com
Diffstat (limited to 'tools/testing/selftests/bpf/test_sysctl.c')
-rw-r--r--tools/testing/selftests/bpf/test_sysctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/test_sysctl.c b/tools/testing/selftests/bpf/test_sysctl.c
index 5bae25ca19fb..57620e7c9048 100644
--- a/tools/testing/selftests/bpf/test_sysctl.c
+++ b/tools/testing/selftests/bpf/test_sysctl.c
@@ -1560,7 +1560,7 @@ static int run_test_case(int cgfd, struct sysctl_test *test)
goto err;
}
- if (bpf_prog_attach(progfd, cgfd, atype, BPF_F_ALLOW_OVERRIDE) == -1) {
+ if (bpf_prog_attach(progfd, cgfd, atype, BPF_F_ALLOW_OVERRIDE) < 0) {
if (test->result == ATTACH_REJECT)
goto out;
else