Skip to contentSkip to conversation

bpf: fix verifier

PATCH In review Wei-Chun Chao 2 participants 2 messages Aug 12, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: fix verifier

Wrong array boundary is used.

Fixes 35578d798400 bpf: Implement function bpf_perf_event_read())
Cc Kaixu Xia <[email protected]>
Cc Alexei Starovoitov <[email protected]>
---
 kernel/bpf/verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
index 48e1c71..ed12e38 100644
@@ -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.
Signature · 1 line
1.9.1
#1 lore raw

I would expect better subject, perhaps something like:
"fix array boundary in check_map_func_compatibility"

Quoted 30 lines · Wed, Aug 12, 2015 at 09:39:34AM CEST, [email protected] wrote:

Wrong array boundary is used.

Fixes 35578d798400 bpf: Implement function bpf_perf_event_read())
Cc Kaixu Xia <[email protected]>
Cc Alexei Starovoitov <[email protected]>

---
kernel/bpf/verifier.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
index 48e1c71..ed12e38 100644
@@ -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.
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html