Messages in this thread Patch in this message | | | From | Florent Revest <> | Subject | [PATCH bpf-next 2/2] bpf: Remove unnecessary map checks for ARG_PTR_TO_CONST_STR | Date | Fri, 23 Apr 2021 01:55:43 +0200 |
| |
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.
Signed-off-by: Florent Revest <revest@chromium.org> Reported-by: Alexei Starovoitov <ast@kernel.org> --- kernel/bpf/verifier.c | 3 +-- 1 file changed, 1 insertion(+), 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 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg, 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; } -- 2.31.1.498.g6c1eba8ee3d-goog
| |