summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-01-28 00:46:27 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-01-28 00:46:27 -0800
commitd1fadc9b7d390adc6e0b40c964be877ef98fec09 (patch)
treebe50d8d491d5bd6f2f76e61ed2574ecff1606e49
parentfb7f86c7e7ff7bcb5eb6dc73beffb9f2b7d3f9ef (diff)
parentefc6aa53ca49b6d2b13875e021d2599de0b9fc38 (diff)
Merge "regulator: qpnp-labibb: fix an out of bounds access"
-rw-r--r--drivers/regulator/qpnp-labibb-regulator.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/regulator/qpnp-labibb-regulator.c b/drivers/regulator/qpnp-labibb-regulator.c
index 8dbe3080873c..67b97256da1f 100644
--- a/drivers/regulator/qpnp-labibb-regulator.c
+++ b/drivers/regulator/qpnp-labibb-regulator.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -3331,7 +3331,7 @@ static int register_qpnp_ibb_regulator(struct qpnp_labibb *labibb,
struct regulator_init_data *init_data;
struct regulator_desc *rdesc = &labibb->ibb_vreg.rdesc;
struct regulator_config cfg = {};
- u8 val, ibb_enable_ctl;
+ u8 val, ibb_enable_ctl, index;
u32 tmp;
if (!of_node) {
@@ -3460,11 +3460,11 @@ static int register_qpnp_ibb_regulator(struct qpnp_labibb *labibb,
return rc;
}
- labibb->ibb_vreg.pwrup_dly = ibb_pwrup_dly_table[
- (val &
- IBB_PWRUP_PWRDN_CTL_1_DLY1_MASK)];
- labibb->ibb_vreg.pwrdn_dly = ibb_pwrdn_dly_table[val &
- IBB_PWRUP_PWRDN_CTL_1_DLY2_MASK];
+ index = (val & IBB_PWRUP_PWRDN_CTL_1_DLY1_MASK) >>
+ IBB_PWRUP_PWRDN_CTL_1_DLY1_SHIFT;
+ labibb->ibb_vreg.pwrup_dly = ibb_pwrup_dly_table[index];
+ index = val & IBB_PWRUP_PWRDN_CTL_1_DLY2_MASK;
+ labibb->ibb_vreg.pwrdn_dly = ibb_pwrdn_dly_table[index];
labibb->ibb_vreg.vreg_enabled = 1;
} else {