mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									98870605b3
								
							
						
					
					
						commit
						c29a4920df
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -5507,7 +5507,7 @@ int btf_distill_func_proto(struct bpf_verifier_log *log,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	args = (const struct btf_param *)(func + 1);
 | 
						args = (const struct btf_param *)(func + 1);
 | 
				
			||||||
	nargs = btf_type_vlen(func);
 | 
						nargs = btf_type_vlen(func);
 | 
				
			||||||
	if (nargs >= MAX_BPF_FUNC_ARGS) {
 | 
						if (nargs > MAX_BPF_FUNC_ARGS) {
 | 
				
			||||||
		bpf_log(log,
 | 
							bpf_log(log,
 | 
				
			||||||
			"The function %s has %d arguments. Too many.\n",
 | 
								"The function %s has %d arguments. Too many.\n",
 | 
				
			||||||
			tname, nargs);
 | 
								tname, nargs);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue