Skip to content

Commit

Permalink
bpf: fix bpf_perf_event_read() loop upper bound
Browse files Browse the repository at this point in the history
Verifier rejects programs incorrectly.

Fixes: 35578d7 ("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>
  • Loading branch information
Wei-Chun Chao authored and David S. Miller committed Aug 12, 2015
1 parent dcef707 commit 140d8b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/bpf/verifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 140d8b3

Please sign in to comment.