[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1283612801.2430.1.camel@phoenix>
Date: Sat, 04 Sep 2010 23:06:41 +0800
From: Axel Lin <axel.lin@...il.com>
To: linux-kernel <linux-kernel@...r.kernel.org>
Cc: Liam Girdwood <lrg@...mlogic.co.uk>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Linus Walleij <linus.walleij@...ricsson.com>,
Sundar Iyer <sundar.iyer@...ricsson.com>
Subject: [PATCH] regulator: ab8500 - fix off-by-one value range checking
for selector
selector is used as array index of info->supported_voltages
Thus the valid value range should be 0 .. info->voltages_len -1
Signed-off-by: Axel Lin <axel.lin@...il.com>
---
drivers/regulator/ab8500.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 3d09580..28c7ae6 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -157,7 +157,7 @@ static int ab8500_list_voltage(struct regulator_dev *rdev, unsigned selector)
if (info->fixed_uV)
return info->fixed_uV;
- if (selector > info->voltages_len)
+ if (selector >= info->voltages_len)
return -EINVAL;
return info->supported_voltages[selector];
--
1.7.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists