[PATCH bpf-next] bpf: Fix maximum permitted number of arguments check

Yuntao Wang posted 1 patch 4 years, 2 months ago
kernel/bpf/btf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH bpf-next] bpf: Fix maximum permitted number of arguments check
Posted by Yuntao Wang 4 years, 2 months ago
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>
---
 kernel/bpf/btf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
2.35.1
Re: [PATCH bpf-next] bpf: Fix maximum permitted number of arguments check
Posted by Martin KaFai Lau 4 years, 2 months ago
On Fri, Mar 25, 2022 at 12:42:38AM +0800, Yuntao Wang wrote:
> 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.
Acked-by: Martin KaFai Lau <kafai@fb.com>
Re: [PATCH bpf-next] bpf: Fix maximum permitted number of arguments check
Posted by patchwork-bot+netdevbpf@kernel.org 4 years, 2 months ago
Hello:

This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Fri, 25 Mar 2022 00:42:38 +0800 you wrote:
> 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>
> ---
>  kernel/bpf/btf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - [bpf-next] bpf: Fix maximum permitted number of arguments check
    https://git.kernel.org/bpf/bpf/c/c29a4920dfca

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html