public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: tps6586x-regulator - fix value range checking for val
@ 2010-08-22 14:38 Axel Lin
  2010-08-22 14:42 ` [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits() Axel Lin
  2010-08-23 10:01 ` [PATCH 1/2] regulator: tps6586x-regulator - fix value range checking for val Mark Brown
  0 siblings, 2 replies; 9+ messages in thread
From: Axel Lin @ 2010-08-22 14:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Mike Rapoport

val is used as array index of ri->voltages.
Thus the valid value range should be 0 .. ri->desc.n_voltages - 1.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/tps6586x-regulator.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index 8cff141..facd439 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -133,7 +133,7 @@ static int tps6586x_ldo_get_voltage(struct regulator_dev *rdev)
 	mask = ((1 << ri->volt_nbits) - 1) << ri->volt_shift;
 	val = (val & mask) >> ri->volt_shift;
 
-	if (val > ri->desc.n_voltages)
+	if (val >= ri->desc.n_voltages)
 		BUG();
 
 	return ri->voltages[val] * 1000;
-- 
1.7.0.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-08-27 13:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-22 14:38 [PATCH 1/2] regulator: tps6586x-regulator - fix value range checking for val Axel Lin
2010-08-22 14:42 ` [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits() Axel Lin
2010-08-23 10:02   ` Mark Brown
2010-08-23 10:09     ` Mike Rapoport
2010-08-25  9:53       ` Liam Girdwood
2010-08-25 15:58         ` Gary King
2010-08-26 21:25         ` Gary King
2010-08-27 13:03           ` Liam Girdwood
2010-08-23 10:01 ` [PATCH 1/2] regulator: tps6586x-regulator - fix value range checking for val Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox