Skip to content

Commit 6bb762f

Browse files
committed
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>
1 parent fadb9c7 commit 6bb762f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/charger/charger_axp2101.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int get_constant_charge_voltage_uv(const struct device *dev, union charge
220220
return ret;
221221
}
222222

223-
if (tmp > ARRAY_SIZE(constant_charge_voltage_lut)) {
223+
if (tmp >= ARRAY_SIZE(constant_charge_voltage_lut)) {
224224
return -EINVAL;
225225
}
226226

0 commit comments

Comments
 (0)