projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b37fa16
)
ab3100: fix off-by-one value range checking for voltage selector
author
Axel Lin
<
[email protected]
>
Mon, 26 Jul 2010 07:34:14 +0000
(15:34 +0800)
committer
Liam Girdwood
<
[email protected]
>
Tue, 27 Jul 2010 10:29:23 +0000
(11:29 +0100)
We use voltage selector as an array index for typ_voltages.
Thus the valid range for voltage selector should be 0..voltages_len-1.
Signed-off-by: Axel Lin <
[email protected]
>
Acked-by: Mark Brown <
[email protected]
>
Acked-by: Linus Walleij <
[email protected]
>
Signed-off-by: Liam Girdwood <
[email protected]
>
drivers/regulator/ab3100.c
patch
|
blob
|
history
diff --git
a/drivers/regulator/ab3100.c
b/drivers/regulator/ab3100.c
index 7b14a67bdca2df021e99b9615657da7d5bd3b361..11790990277a3dbd9a96ca2ba398f505480f5e19 100644
(file)
--- a/
drivers/regulator/ab3100.c
+++ b/
drivers/regulator/ab3100.c
@@
-286,7
+286,7
@@
static int ab3100_list_voltage_regulator(struct regulator_dev *reg,
{
struct ab3100_regulator *abreg = reg->reg_data;
- if (selector > abreg->voltages_len)
+ if (selector >
=
abreg->voltages_len)
return -EINVAL;
return abreg->typ_voltages[selector];
}
@@
-318,7
+318,7
@@
static int ab3100_get_voltage_regulator(struct regulator_dev *reg)
regval &= 0xE0;
regval >>= 5;
- if (regval > abreg->voltages_len) {
+ if (regval >
=
abreg->voltages_len) {
dev_err(®->dev,
"regulator register %02x contains an illegal voltage setting\n",
abreg->regreg);