lkml.org 
[lkml]   [2021]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH bpf-next 2/2] bpf: Remove unnecessary map checks for ARG_PTR_TO_CONST_STR
Date
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
\
 
 \ /
  Last update: 2021-04-23 01:57    [W:0.072 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site