Browse Source

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>
pull/90261/merge
Ricardo Rivera-Matos 1 month ago committed by Benjamin Cabé
parent
commit
2bb7fcc5df
  1. 2
      drivers/charger/charger_axp2101.c

2
drivers/charger/charger_axp2101.c

@ -220,7 +220,7 @@ static int get_constant_charge_voltage_uv(const struct device *dev, union charge @@ -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;
}

Loading…
Cancel
Save