summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei-Chun Chao <weichunc@plumgrid.com>2015-08-12 07:57:12 -0700
committerDavid S. Miller <davem@davemloft.net>2015-08-12 16:42:50 -0700
commit140d8b335a9beb234fd0ed9a15aa6a47f47fd771 (patch)
tree8e68a8ebfcc14bcda57bc1cca307a9d8b0534eb5
parentdcef70704d6c2792c6025ceba9708554d441a4bb (diff)
downloadlinux-140d8b335a9beb234fd0ed9a15aa6a47f47fd771.tar.bz2
bpf: fix bpf_perf_event_read() loop upper bound
Verifier rejects programs incorrectly. Fixes: 35578d798400 ("bpf: Implement function bpf_perf_event_read()") Cc: Kaixu Xia <xiakaixu@huawei.com> Cc: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: Wei-Chun Chao <weichunc@plumgrid.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--kernel/bpf/verifier.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 48e1c7192560..ed12e385fb75 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -853,7 +853,7 @@ static int check_map_func_compatibility(struct bpf_map *map, int func_id)
if (!map)
return 0;
- for (i = 0; i <= ARRAY_SIZE(func_limit); i++) {
+ for (i = 0; i < ARRAY_SIZE(func_limit); i++) {
bool_map = (map->map_type == func_limit[i].map_type);
bool_func = (func_id == func_limit[i].func_id);
/* only when map & func pair match it can continue.