From: Florent Revest Date: Thu, 22 Apr 2021 23:55:43 +0000 (+0200) Subject: bpf: Remove unnecessary map checks for ARG_PTR_TO_CONST_STR X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a8fad73e3334151196acb28c4dcde37732c82542;p=linux.git bpf: Remove unnecessary map checks for ARG_PTR_TO_CONST_STR reg->type is enforced by check_reg_type() and map should never be NULL (it would already have been dereferenced anyway) so these checks are unnecessary. Reported-by: Alexei Starovoitov Signed-off-by: Florent Revest Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20210422235543.4007694-3-revest@chromium.org --- diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 59799a9b014aa..2579f6fbb5c31 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -5075,8 +5075,7 @@ skip_type_check: u64 map_addr; char *str_ptr; - if (reg->type != PTR_TO_MAP_VALUE || !map || - !bpf_map_is_rdonly(map)) { + if (!bpf_map_is_rdonly(map)) { verbose(env, "R%d does not point to a readonly map'\n", regno); return -EACCES; }