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
This commit is contained in:
Florent Revest 2021-04-23 01:55:43 +02:00 committed by Alexei Starovoitov
parent 8e8ee109b0
commit a8fad73e33

View 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;
}