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 <ricardo.rivera-matos@cirrus.com>
This commit is contained in:
Ricardo Rivera-Matos 2025-05-27 16:21:34 -05:00 committed by Benjamin Cabé
commit 2bb7fcc5df

View file

@ -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;
}