mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
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: 5c9668cfc6
("firewall: introduce stm32_firewall framework")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
This commit is contained in:
parent
2eeb74c449
commit
e4500d7525
@ -53,7 +53,7 @@ int stm32_firewall_get_firewall(struct device_node *np, struct stm32_firewall *f
|
||||
return err;
|
||||
}
|
||||
|
||||
if (j > nb_firewall) {
|
||||
if (j >= nb_firewall) {
|
||||
pr_err("Too many firewall controllers");
|
||||
of_node_put(provider);
|
||||
return -EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user