Commit 28a8add6 authored by Brendan Jackman's avatar Brendan Jackman Committed by Daniel Borkmann
Browse files

bpf: Fix a verifier message for alloc size helper arg



The error message here is misleading, the argument will be rejected unless
it is a known constant.

Signed-off-by: default avatarBrendan Jackman <jackmanb@google.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarYonghong Song <yhs@fb.com>
Acked-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210112123913.2016804-1-jackmanb@google.com
parent c6458e72
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4319,7 +4319,7 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg,
			err = mark_chain_precision(env, regno);
	} else if (arg_type_is_alloc_size(arg_type)) {
		if (!tnum_is_const(reg->var_off)) {
			verbose(env, "R%d unbounded size, use 'var &= const' or 'if (var < const)'\n",
			verbose(env, "R%d is not a known constant'\n",
				regno);
			return -EACCES;
		}