Commit e4500d75 authored by Dan Carpenter's avatar Dan Carpenter Committed by Alexandre Torgue

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: 5c9668cf ("firewall: introduce stm32_firewall framework")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarGatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: default avatarAlexandre Torgue <alexandre.torgue@foss.st.com>
parent 2eeb74c4
...@@ -53,7 +53,7 @@ int stm32_firewall_get_firewall(struct device_node *np, struct stm32_firewall *f ...@@ -53,7 +53,7 @@ int stm32_firewall_get_firewall(struct device_node *np, struct stm32_firewall *f
return err; return err;
} }
if (j > nb_firewall) { if (j >= nb_firewall) {
pr_err("Too many firewall controllers"); pr_err("Too many firewall controllers");
of_node_put(provider); of_node_put(provider);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment