summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorFlorent Revest <revest@chromium.org>2021-04-23 02:55:43 +0300
committerAlexei Starovoitov <ast@kernel.org>2021-04-23 19:58:21 +0300
commita8fad73e3334151196acb28c4dcde37732c82542 (patch)
tree8282ba0f8b0229af59a7e21bdc5b61b83405dde5 /kernel
parent8e8ee109b02c0e90021d63cd20dd0157c021f7a4 (diff)
downloadlinux-a8fad73e3334151196acb28c4dcde37732c82542.tar.xz
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 <ast@kernel.org> Signed-off-by: Florent Revest <revest@chromium.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210422235543.4007694-3-revest@chromium.org
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/verifier.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 59799a9b014a..2579f6fbb5c3 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;
}