All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: add check index of wm8350->pmic.pdev[]
@ 2009-06-15 20:30 Roel Kluin
  2009-06-15 18:38 ` Mark Brown
  2009-06-16  9:15 ` Liam Girdwood
  0 siblings, 2 replies; 3+ messages in thread
From: Roel Kluin @ 2009-06-15 20:30 UTC (permalink / raw)
  To: lrg; +Cc: LKML, Andrew Morton

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index 771eca1..c806259 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-16  9:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-15 20:30 [PATCH] regulator: add check index of wm8350->pmic.pdev[] Roel Kluin
2009-06-15 18:38 ` Mark Brown
2009-06-16  9:15 ` Liam Girdwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.