[PATCH] regulator mc13783: bail out without platform data

Subsystems: the rest, voltage and current regulator framework

STALE5275d

3 messages, 2 authors, 2012-03-01 · open the first message on its own page

[PATCH] regulator mc13783: bail out without platform data

From: Sascha Hauer <s.hauer@pengutronix.de>
Date: 2012-02-29 08:01:48

the platform data pointer is used without checking it. Bail out
in the driver instead of crashing the kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/regulator/mc13783-regulator.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
index 8e9b90a..6c0face 100644
--- a/drivers/regulator/mc13783-regulator.c
+++ b/drivers/regulator/mc13783-regulator.c
@@ -344,6 +344,9 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
 
 	dev_dbg(&pdev->dev, "%s id %d\n", __func__, pdev->id);
 
+	if (!pdata)
+		return -EINVAL;
+
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv) +
 			pdata->num_regulators * sizeof(priv->regulators[0]),
 			GFP_KERNEL);
-- 
1.7.9.1

Re: [PATCH] regulator mc13783: bail out without platform data

From: Mark Brown <hidden>
Date: 2012-02-29 23:19:57

On Wed, Feb 29, 2012 at 09:01:40AM +0100, Sascha Hauer wrote:
the platform data pointer is used without checking it. Bail out
in the driver instead of crashing the kernel.
Applied, thanks.  Ideally the platform data would just specify the
constraints and the driver would still be able to register the
regulators even without constriants being provided to allow diagnostics.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120229/42496cfb/attachment.sig>

Re: [PATCH] regulator mc13783: bail out without platform data

From: Sascha Hauer <s.hauer@pengutronix.de>
Date: 2012-03-01 09:58:51

On Wed, Feb 29, 2012 at 11:19:51PM +0000, Mark Brown wrote:
On Wed, Feb 29, 2012 at 09:01:40AM +0100, Sascha Hauer wrote:
quoted
the platform data pointer is used without checking it. Bail out
in the driver instead of crashing the kernel.
Applied, thanks.  Ideally the platform data would just specify the
constraints and the driver would still be able to register the
regulators even without constriants being provided to allow diagnostics.
Indeed. I can follow up on this when I find the time. For now I'm happy
with the kernel not crashing.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help