summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorYuntao Wang <ytcoode@gmail.com>2022-03-25 00:42:38 +0800
committerAlexei Starovoitov <ast@kernel.org>2022-03-28 19:08:17 -0700
commitc29a4920dfcaa1433b09e2674f605f72767a385c (patch)
treec00840a8ab95456930d9c5a02e6211d9a48ca4a7 /kernel
parent98870605b3742c38353b50b6dbad33fab9de415f (diff)
bpf: Fix maximum permitted number of arguments check
Since the m->arg_size array can hold up to MAX_BPF_FUNC_ARGS argument sizes, it's ok that nargs is equal to MAX_BPF_FUNC_ARGS. Signed-off-by: Yuntao Wang <ytcoode@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20220324164238.1274915-1-ytcoode@gmail.com
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/btf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 24788ce564a0..0918a39279f6 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -5507,7 +5507,7 @@ int btf_distill_func_proto(struct bpf_verifier_log *log,
}
args = (const struct btf_param *)(func + 1);
nargs = btf_type_vlen(func);
- if (nargs >= MAX_BPF_FUNC_ARGS) {
+ if (nargs > MAX_BPF_FUNC_ARGS) {
bpf_log(log,
"The function %s has %d arguments. Too many.\n",
tname, nargs);