]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bpf: Remove unnecessary map checks for ARG_PTR_TO_CONST_STR
authorFlorent Revest <revest@chromium.org>
Thu, 22 Apr 2021 23:55:43 +0000 (01:55 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 23 Apr 2021 16:58:21 +0000 (09:58 -0700)
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
kernel/bpf/verifier.c

index 59799a9b014aa69a69f298a20d4b30b39241e9a2..2579f6fbb5c312191f7bf4cc0fd590ae1c4ad5b3 100644 (file)
@@ -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;
                }