Skip to content

Commit e4500d7

Browse files
Dan CarpenterAlexandre Torgue
authored andcommitted
bus: stm32_firewall: fix off by one in stm32_firewall_get_firewall()
The "nb_firewall" variable is the number of elements in the firewall[] array, which is allocated in stm32_firewall_populate_bus(). So change this > comparison to >= to prevent an out of bound access. Fixes: 5c9668c ("firewall: introduce stm32_firewall framework") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Gatien Chevallier <[email protected]> Signed-off-by: Alexandre Torgue <[email protected]>
1 parent 2eeb74c commit e4500d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/bus/stm32_firewall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int stm32_firewall_get_firewall(struct device_node *np, struct stm32_firewall *f
5353
return err;
5454
}
5555

56-
if (j > nb_firewall) {
56+
if (j >= nb_firewall) {
5757
pr_err("Too many firewall controllers");
5858
of_node_put(provider);
5959
return -EINVAL;

0 commit comments

Comments
 (0)