aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/samples/bpf/xdp_redirect_cpu_user.c
diff options
context:
space:
mode:
authorDaniel T. Lee <danieltimlee@gmail.com>2020-05-16 13:06:04 +0900
committerDaniel Borkmann <daniel@iogearbox.net>2020-05-19 17:12:49 +0200
commit0efdcefb00d768442efef21560ea4c44d481fa5c (patch)
tree8be1ed7d70e6a61c43d53f984061e5d2acd1e4a3 /samples/bpf/xdp_redirect_cpu_user.c
parentbpf: Selftests, add ktls tests to test_sockmap (diff)
downloadwireguard-linux-0efdcefb00d768442efef21560ea4c44d481fa5c.tar.xz
wireguard-linux-0efdcefb00d768442efef21560ea4c44d481fa5c.zip
samples, bpf: Refactor pointer error check with libbpf
Current method of checking pointer error is not user friendly. Especially the __must_check define makes this less intuitive. Since, libbpf has an API libbpf_get_error() which checks pointer error, this commit refactors existing pointer error check logic with libbpf. Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20200516040608.1377876-2-danieltimlee@gmail.com
Diffstat (limited to '')
-rw-r--r--samples/bpf/xdp_redirect_cpu_user.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/samples/bpf/xdp_redirect_cpu_user.c b/samples/bpf/xdp_redirect_cpu_user.c
index 9b8f21abeac4..f3468168982e 100644
--- a/samples/bpf/xdp_redirect_cpu_user.c
+++ b/samples/bpf/xdp_redirect_cpu_user.c
@@ -19,9 +19,6 @@ static const char *__doc__ =
#include <time.h>
#include <linux/limits.h>
-#define __must_check
-#include <linux/err.h>
-
#include <arpa/inet.h>
#include <linux/if_link.h>
@@ -622,7 +619,7 @@ static struct bpf_link * attach_tp(struct bpf_object *obj,
}
link = bpf_program__attach_tracepoint(prog, tp_category, tp_name);
- if (IS_ERR(link))
+ if (libbpf_get_error(link))
exit(EXIT_FAIL_BPF);
return link;