Skip to content

Commit

Permalink
regulator: keep index within bounds in da9034_get_ldo12_voltage()
Browse files Browse the repository at this point in the history
If selector equals ARRAY_SIZE(da9034_ldo12_data), that is one too
large already.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Roel Kluin authored and Liam Girdwood committed Dec 17, 2009
1 parent ddec681 commit 495353a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/da903x.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ static int da9034_get_ldo12_voltage(struct regulator_dev *rdev)
static int da9034_list_ldo12_voltage(struct regulator_dev *rdev,
unsigned selector)
{
if (selector > ARRAY_SIZE(da9034_ldo12_data))
if (selector >= ARRAY_SIZE(da9034_ldo12_data))
return -EINVAL;
return da9034_ldo12_data[selector] * 1000;
}
Expand Down

0 comments on commit 495353a

Please sign in to comment.