regulator: keep index within bounds in da9034_get_ldo12_voltage()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, December 17, 2009 - 9:59 am

Gitweb:     http://git.kernel.org/linus/495353a3f7fbb11e5100c9258365ff65a4834b37
Commit:     495353a3f7fbb11e5100c9258365ff65a4834b37
Parent:     ddec68107ab101d9ff934811d5598f5c613027f2
Author:     Roel Kluin <roel.kluin@gmail.com>
AuthorDate: Mon Oct 26 12:37:11 2009 +0100
Committer:  Liam Girdwood <lrg@slimlogic.co.uk>
CommitDate: Thu Dec 17 10:27:25 2009 +0000

    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 <roel.kluin@gmail.com>
    Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
---
 drivers/regulator/da903x.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index aa224d9..f8c4661 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;
 }
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
regulator: keep index within bounds in da9034_get_ldo12_vo ..., Linux Kernel Mailing ..., (Thu Dec 17, 9:59 am)