Skip to contentSkip to conversation

BPF: remove useless condition check

PATCH New [email protected] 1 participant 1 message Apr 7, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BPF: remove useless condition check

From: zhongjun <[email protected]>

According to contents of 'linux/bpf_types.h', array size of bpf_verifier_ops will never be ZERO.
Removing useless check to make code more straight and optimal.

base-commit: 738a96c4a8c36950803fdd27e7c30aca92dccefd

---
 kernel/bpf/verifier.c | 4 ----
 1 file changed, 4 deletions(-)
kernel/bpf/verifier.c +0 -4
index d517d13878cf..21047b26dae7 100644
@@ -17655,10 +17655,6 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr)
 	int i, len, ret = -EINVAL;
 	bool is_priv;
 
-	/* no program is valid */
-	if (ARRAY_SIZE(bpf_verifier_ops) == 0)
-		return -EINVAL;
-
 	/* 'struct bpf_verifier_env' can be global, but since it's not small,
 	 * allocate/free it every time bpf_check() is called
 	 */
Signature · 1 line
2.20.1