* [PATCH] regulator: ti-abb: Fix off-by-one valid range checking for abb->current_info_idx
@ 2013-05-04 14:02 Axel Lin
2013-05-04 15:19 ` Nishanth Menon
2013-05-05 10:23 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2013-05-04 14:02 UTC (permalink / raw)
To: Mark Brown
Cc: Andrii.Tseglytskyi, Nishanth Menon, Liam Girdwood, linux-kernel
abb->current_info_idx is used as array subscript to access volt_table,
thus the valid value range should be 0 ... desc->n_voltages - 1.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/ti-abb-regulator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
index c1870ea..870d209 100644
--- a/drivers/regulator/ti-abb-regulator.c
+++ b/drivers/regulator/ti-abb-regulator.c
@@ -387,8 +387,8 @@ static int ti_abb_get_voltage_sel(struct regulator_dev *rdev)
return -EINVAL;
}
- if (abb->current_info_idx > (int)desc->n_voltages) {
- dev_err(dev, "%s: Corrupted data? idx(%d) > n_voltages(%d)\n",
+ if (abb->current_info_idx >= (int)desc->n_voltages) {
+ dev_err(dev, "%s: Corrupted data? idx(%d) >= n_voltages(%d)\n",
__func__, abb->current_info_idx, desc->n_voltages);
return -EINVAL;
}
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] regulator: ti-abb: Fix off-by-one valid range checking for abb->current_info_idx
2013-05-04 14:02 [PATCH] regulator: ti-abb: Fix off-by-one valid range checking for abb->current_info_idx Axel Lin
@ 2013-05-04 15:19 ` Nishanth Menon
2013-05-05 10:23 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Nishanth Menon @ 2013-05-04 15:19 UTC (permalink / raw)
To: Axel Lin; +Cc: Mark Brown, Andrii.Tseglytskyi, Liam Girdwood, linux-kernel
Change in Liam's email ID.
On 22:02-20130504, Axel Lin wrote:
> abb->current_info_idx is used as array subscript to access volt_table,
> thus the valid value range should be 0 ... desc->n_voltages - 1.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/regulator/ti-abb-regulator.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
> index c1870ea..870d209 100644
> --- a/drivers/regulator/ti-abb-regulator.c
> +++ b/drivers/regulator/ti-abb-regulator.c
> @@ -387,8 +387,8 @@ static int ti_abb_get_voltage_sel(struct regulator_dev *rdev)
> return -EINVAL;
> }
>
> - if (abb->current_info_idx > (int)desc->n_voltages) {
> - dev_err(dev, "%s: Corrupted data? idx(%d) > n_voltages(%d)\n",
> + if (abb->current_info_idx >= (int)desc->n_voltages) {
> + dev_err(dev, "%s: Corrupted data? idx(%d) >= n_voltages(%d)\n",
> __func__, abb->current_info_idx, desc->n_voltages);
> return -EINVAL;
> }
> --
> 1.8.1.2
Thanks for the same.
Acked-by: Nishanth Menon <nm@ti.com>
--
Regards,
Nishanth Menon
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] regulator: ti-abb: Fix off-by-one valid range checking for abb->current_info_idx
2013-05-04 14:02 [PATCH] regulator: ti-abb: Fix off-by-one valid range checking for abb->current_info_idx Axel Lin
2013-05-04 15:19 ` Nishanth Menon
@ 2013-05-05 10:23 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2013-05-05 10:23 UTC (permalink / raw)
To: Axel Lin; +Cc: Andrii.Tseglytskyi, Nishanth Menon, Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
On Sat, May 04, 2013 at 10:02:27PM +0800, Axel Lin wrote:
> abb->current_info_idx is used as array subscript to access volt_table,
> thus the valid value range should be 0 ... desc->n_voltages - 1.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-05 10:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-04 14:02 [PATCH] regulator: ti-abb: Fix off-by-one valid range checking for abb->current_info_idx Axel Lin
2013-05-04 15:19 ` Nishanth Menon
2013-05-05 10:23 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox