aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2024-04-12 11:25:37 +0300
committerAlexandre Torgue <alexandre.torgue@foss.st.com>2024-04-25 14:44:39 +0200
commite4500d7525f9223a0a46431caa6d0f2d165f05ce (patch)
tree990a5c02c8b4953a30703740ca809afa22802cea
parent2eeb74c449e910851fa48f4868ec0edadaa28f08 (diff)
downloadstm32-bus-firewall-for-v6.10.tar.gz
bus: stm32_firewall: fix off by one in stm32_firewall_get_firewall()stm32-bus-firewall-for-v6.10-1stm32-bus-firewall-for-v6.10
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: 5c9668cfc6d7 ("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>
-rw-r--r--drivers/bus/stm32_firewall.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/bus/stm32_firewall.c b/drivers/bus/stm32_firewall.c
index decb7944904767..2fc9761dadecf3 100644
--- a/drivers/bus/stm32_firewall.c
+++ b/drivers/bus/stm32_firewall.c
@@ -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;