From 2bb7fcc5df6aa2ecef162fb9185cf1e2be283513 Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Tue, 27 May 2025 16:21:34 -0500 Subject: [PATCH] charger: axp2101: Guards against out-of-bounds read Corrects the out-of-bounds check when reading constant_charge_voltage_lut Signed-off-by: Ricardo Rivera-Matos --- drivers/charger/charger_axp2101.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/charger/charger_axp2101.c b/drivers/charger/charger_axp2101.c index 53fc945ec2c..68815d9303b 100644 --- a/drivers/charger/charger_axp2101.c +++ b/drivers/charger/charger_axp2101.c @@ -220,7 +220,7 @@ static int get_constant_charge_voltage_uv(const struct device *dev, union charge return ret; } - if (tmp > ARRAY_SIZE(constant_charge_voltage_lut)) { + if (tmp >= ARRAY_SIZE(constant_charge_voltage_lut)) { return -EINVAL; }