selftests/bpf: Don't use libbpf_get_error() in kprobe_multi_test
authorHou Tao <houtao1@huawei.com>
Fri, 15 Dec 2023 10:07:07 +0000 (18:07 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 15 Dec 2023 21:54:55 +0000 (22:54 +0100)
commit00cdcd2900bdb9190d1e75438b39cef74cd99232
tree7c7977496850c4fa2e9bc22f18599886a98ee1cb
parent0d83786f5661154d015b498a3d23d4c37e30f6ef
selftests/bpf: Don't use libbpf_get_error() in kprobe_multi_test

Since libbpf v1.0, libbpf doesn't return error code embedded into the
pointer iteself, libbpf_get_error() is deprecated and it is basically
the same as using -errno directly.

So replace the invocations of libbpf_get_error() by -errno in
kprobe_multi_test. For libbpf_get_error() in test_attach_api_fails(),
saving -errno before invoking ASSERT_xx() macros just in case that
errno is overwritten by these macros. However, the invocation of
libbpf_get_error() in get_syms() should be kept intact, because
hashmap__new() still returns a pointer with embedded error code.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20231215100708.2265609-5-houtao@huaweicloud.com
tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c