diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-05-04 16:02:27 +0200 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-05-12 16:31:36 +0200 |
commit | f5cd8de2ce32e25e399f1d49d4876bf9450163a2 (patch) | |
tree | e5cf65c0286ce4c22621865e48494d54c1971044 /drivers/regulator | |
parent | regulator: Introduce TI Adaptive Body Bias(ABB) on-chip LDO driver (diff) | |
download | linux-f5cd8de2ce32e25e399f1d49d4876bf9450163a2.tar.xz linux-f5cd8de2ce32e25e399f1d49d4876bf9450163a2.zip |
regulator: ti-abb: Fix off-by-one valid range checking for abb->current_info_idx
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>
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/ti-abb-regulator.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c index c1870ea64939..870d209ec866 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; } |