* [PATCH] regulator: ab8500 - fix off-by-one value range checking for selector
@ 2010-09-04 15:06 Axel Lin
2010-09-05 8:48 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-09-04 15:06 UTC (permalink / raw)
To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Linus Walleij, Sundar Iyer
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@gmail.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-05 8:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-04 15:06 [PATCH] regulator: ab8500 - fix off-by-one value range checking for selector Axel Lin
2010-09-05 8:48 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox