* [PATCH] max8998: fix off-by-one value range checking
@ 2010-08-04 6:34 Axel Lin
2010-08-04 6:39 ` Kyungmin Park
2010-08-04 7:50 ` Mark Brown
0 siblings, 2 replies; 5+ messages in thread
From: Axel Lin @ 2010-08-04 6:34 UTC (permalink / raw)
To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Kyungmin Park, Marek Szyprowski
In max8998_list_voltage() and max8998_set_voltage(),
we use ldo as array index of ldo_voltage_map.
Thus the valid range should be 0 .. ARRAY_SIZE(ldo_voltage_map)-1.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/max8998.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index 03e55a1..ab67298 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -119,7 +119,7 @@ static int max8998_list_voltage(struct regulator_dev *rdev,
int ldo = max8998_get_ldo(rdev);
int val;
- if (ldo > ARRAY_SIZE(ldo_voltage_map))
+ if (ldo >= ARRAY_SIZE(ldo_voltage_map))
return -EINVAL;
desc = ldo_voltage_map[ldo];
@@ -306,7 +306,7 @@ static int max8998_set_voltage(struct regulator_dev *rdev,
u8 val;
bool en_ramp = false;
- if (ldo > ARRAY_SIZE(ldo_voltage_map))
+ if (ldo >= ARRAY_SIZE(ldo_voltage_map))
return -EINVAL;
desc = ldo_voltage_map[ldo];
--
1.5.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] max8998: fix off-by-one value range checking
2010-08-04 6:34 [PATCH] max8998: fix off-by-one value range checking Axel Lin
@ 2010-08-04 6:39 ` Kyungmin Park
2010-08-04 7:50 ` Mark Brown
1 sibling, 0 replies; 5+ messages in thread
From: Kyungmin Park @ 2010-08-04 6:39 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, Mark Brown, Marek Szyprowski
Nice catch.
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
On Wed, Aug 4, 2010 at 3:34 PM, Axel Lin <axel.lin@gmail.com> wrote:
> In max8998_list_voltage() and max8998_set_voltage(),
> we use ldo as array index of ldo_voltage_map.
> Thus the valid range should be 0 .. ARRAY_SIZE(ldo_voltage_map)-1.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/regulator/max8998.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
> index 03e55a1..ab67298 100644
> --- a/drivers/regulator/max8998.c
> +++ b/drivers/regulator/max8998.c
> @@ -119,7 +119,7 @@ static int max8998_list_voltage(struct regulator_dev *rdev,
> int ldo = max8998_get_ldo(rdev);
> int val;
>
> - if (ldo > ARRAY_SIZE(ldo_voltage_map))
> + if (ldo >= ARRAY_SIZE(ldo_voltage_map))
> return -EINVAL;
>
> desc = ldo_voltage_map[ldo];
> @@ -306,7 +306,7 @@ static int max8998_set_voltage(struct regulator_dev *rdev,
> u8 val;
> bool en_ramp = false;
>
> - if (ldo > ARRAY_SIZE(ldo_voltage_map))
> + if (ldo >= ARRAY_SIZE(ldo_voltage_map))
> return -EINVAL;
>
> desc = ldo_voltage_map[ldo];
> --
> 1.5.4.3
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] max8998: fix off-by-one value range checking
2010-08-04 6:34 [PATCH] max8998: fix off-by-one value range checking Axel Lin
2010-08-04 6:39 ` Kyungmin Park
@ 2010-08-04 7:50 ` Mark Brown
2010-08-04 8:08 ` Liam Girdwood
2010-08-05 1:43 ` Axel Lin
1 sibling, 2 replies; 5+ messages in thread
From: Mark Brown @ 2010-08-04 7:50 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, Kyungmin Park, Marek Szyprowski
On Wed, Aug 04, 2010 at 02:34:10PM +0800, Axel Lin wrote:
> In max8998_list_voltage() and max8998_set_voltage(),
> we use ldo as array index of ldo_voltage_map.
> Thus the valid range should be 0 .. ARRAY_SIZE(ldo_voltage_map)-1.
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel, please do try to bear in mind my previous comments about supplying
subject lines for your commits consistent with those for the relevant
code area. This makes your patches easier to apply.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] max8998: fix off-by-one value range checking
2010-08-04 7:50 ` Mark Brown
@ 2010-08-04 8:08 ` Liam Girdwood
2010-08-05 1:43 ` Axel Lin
1 sibling, 0 replies; 5+ messages in thread
From: Liam Girdwood @ 2010-08-04 8:08 UTC (permalink / raw)
To: Mark Brown; +Cc: Axel Lin, linux-kernel, Kyungmin Park, Marek Szyprowski
On Wed, 2010-08-04 at 08:50 +0100, Mark Brown wrote:
> On Wed, Aug 04, 2010 at 02:34:10PM +0800, Axel Lin wrote:
> > In max8998_list_voltage() and max8998_set_voltage(),
> > we use ldo as array index of ldo_voltage_map.
> > Thus the valid range should be 0 .. ARRAY_SIZE(ldo_voltage_map)-1.
>
> > Signed-off-by: Axel Lin <axel.lin@gmail.com>
>
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
>
Applied.
Thanks
Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] max8998: fix off-by-one value range checking
2010-08-04 7:50 ` Mark Brown
2010-08-04 8:08 ` Liam Girdwood
@ 2010-08-05 1:43 ` Axel Lin
1 sibling, 0 replies; 5+ messages in thread
From: Axel Lin @ 2010-08-05 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, Liam Girdwood, Kyungmin Park, Marek Szyprowski
2010/8/4 Mark Brown <broonie@opensource.wolfsonmicro.com>:
> On Wed, Aug 04, 2010 at 02:34:10PM +0800, Axel Lin wrote:
>> In max8998_list_voltage() and max8998_set_voltage(),
>> we use ldo as array index of ldo_voltage_map.
>> Thus the valid range should be 0 .. ARRAY_SIZE(ldo_voltage_map)-1.
>
>> Signed-off-by: Axel Lin <axel.lin@gmail.com>
>
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
>
> Axel, please do try to bear in mind my previous comments about supplying
> subject lines for your commits consistent with those for the relevant
> code area. This makes your patches easier to apply.
>
OK, will improve it next time.
Regards,
Axel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-08-05 1:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-04 6:34 [PATCH] max8998: fix off-by-one value range checking Axel Lin
2010-08-04 6:39 ` Kyungmin Park
2010-08-04 7:50 ` Mark Brown
2010-08-04 8:08 ` Liam Girdwood
2010-08-05 1:43 ` Axel Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox