From 495353a3f7fbb11e5100c9258365ff65a4834b37 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Mon, 26 Oct 2009 12:37:11 +0100 Subject: regulator: keep index within bounds in da9034_get_ldo12_voltage() If selector equals ARRAY_SIZE(da9034_ldo12_data), that is one too large already. Signed-off-by: Roel Kluin Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- drivers/regulator/da903x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/regulator') diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c index aa224d936e0d..f8c4661a7a81 100644 --- a/drivers/regulator/da903x.c +++ b/drivers/regulator/da903x.c @@ -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; } -- cgit v1.2.3