summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSimon Wang <wangchuanguo@inspur.com>2022-06-21 23:19:23 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2022-06-24 15:40:42 +0200
commit395e942d34a25824457da379baf434b5d6da4dcc (patch)
treeb0f9944fbc7adbb92a6c01d6552a5a68e9d058e4 /kernel
parent6dc7a0baf1a70b7d22662d38481824c14ddd80c5 (diff)
downloadlinux-stable-395e942d34a25824457da379baf434b5d6da4dcc.tar.gz
linux-stable-395e942d34a25824457da379baf434b5d6da4dcc.tar.bz2
linux-stable-395e942d34a25824457da379baf434b5d6da4dcc.zip
bpf: Replace hard-coded 0 with BPF_K in check_alu_op
Enhance readability a bit. Signed-off-by: Simon Wang <wangchuanguo@inspur.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20220622031923.65692-1-wangchuanguo@inspur.com
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/verifier.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index a20d7736a5b2..f228141c01c5 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -9096,7 +9096,7 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn)
if (opcode == BPF_END || opcode == BPF_NEG) {
if (opcode == BPF_NEG) {
- if (BPF_SRC(insn->code) != 0 ||
+ if (BPF_SRC(insn->code) != BPF_K ||
insn->src_reg != BPF_REG_0 ||
insn->off != 0 || insn->imm != 0) {
verbose(env, "BPF_NEG uses reserved fields\n");