aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYafang Shao <[email protected]>2018-02-23 14:58:41 +0800
committerDaniel Borkmann <[email protected]>2018-02-23 16:23:11 +0100
commitee07862f7b4594d390b978f6636a6a6191632ab3 (patch)
treef72ef4109f87aad9951bf5d3641db327374ea071
parent0b6b8a3dd86db78c3f38587d667d77065c75e4f8 (diff)
bpf: NULL pointer check is not needed in BPF_CGROUP_RUN_PROG_INET_SOCK
sk is already allocated in inet_create/inet6_create, hence when BPF_CGROUP_RUN_PROG_INET_SOCK is executed sk will never be NULL. The logic is as bellow, sk = sk_alloc(); if (!sk) goto out; BPF_CGROUP_RUN_PROG_INET_SOCK(sk); Signed-off-by: Yafang Shao <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
-rw-r--r--include/linux/bpf-cgroup.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index a7f16e0f8d68..8a4566691c8f 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -96,7 +96,7 @@ int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor,
#define BPF_CGROUP_RUN_PROG_INET_SOCK(sk) \
({ \
int __ret = 0; \
- if (cgroup_bpf_enabled && sk) { \
+ if (cgroup_bpf_enabled) { \
__ret = __cgroup_bpf_run_filter_sk(sk, \
BPF_CGROUP_INET_SOCK_CREATE); \
} \