Skip to contentSkip to conversation

regulator: add check index of wm8350->pmic.pdev[]

PATCH Applied Roel Kluin 3 participants 3 messages Jun 15, 2009 – Jun 16, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 regulator: add check index of wm8350->pmic.pdev[]

Ensure that reg is within the bounds of array wm8350->pmic.pdev[].

---

drivers/regulator/wm8350-regulator.c +2 -0
index 771eca1..c806259 100644
@@ -1419,6 +1419,8 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
 {
 	struct platform_device *pdev;
 	int ret;
+	if (reg < 0 || reg >= NUM_WM8350_REGULATORS)
+		return -EINVAL;
 
 	if (wm8350->pmic.pdev[reg])
 		return -EBUSY;
#2 lore raw
In reply to Roel Kluin
Quoted 9 lines · Roel Kluin

Ensure that reg is within the bounds of array wm8350->pmic.pdev[].

---

drivers/regulator/wm8350-regulator.c +0 -0
index 771eca1..c806259 100644

drivers/regulator/wm8350-regulator.c int wm8350_register_regulator(struct wm8350 *wm8350, int reg, · line 1426

Quoted 8 lines
drivers/regulator/wm8350-regulator.c +2 -0
@@ -1419,6 +1419,8 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
 {
 	struct platform_device *pdev;
 	int ret;
+	if (reg < 0 || reg >= NUM_WM8350_REGULATORS)
+		return -EINVAL;
 
 	if (wm8350->pmic.pdev[reg])
 		return -EBUSY;

Applied.

Thanks.

Liam