linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] mfd: pm8921: potential NULL dereference in pm8921_remove()
@ 2013-11-07  8:04 Dan Carpenter
  2013-11-07 10:06 ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2013-11-07  8:04 UTC (permalink / raw)
  To: David Brown, Abhijeet Dharmapurikar
  Cc: Daniel Walker, Bryan Huntsman, Samuel Ortiz, Lee Jones,
	linux-arm-msm, kernel-janitors

We assume that "pmic" could be NULL and then dereference it two lines
later.  I fix this by moving the dereference inside the NULL check.

Fixes: c013f0a56c56 ('mfd: Add pm8xxx irq support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c
index a6841f7..484fe66 100644
--- a/drivers/mfd/pm8921-core.c
+++ b/drivers/mfd/pm8921-core.c
@@ -171,11 +171,12 @@ static int pm8921_remove(struct platform_device *pdev)
 	drvdata = platform_get_drvdata(pdev);
 	if (drvdata)
 		pmic = drvdata->pm_chip_data;
-	if (pmic)
+	if (pmic) {
 		mfd_remove_devices(pmic->dev);
-	if (pmic->irq_chip) {
-		pm8xxx_irq_exit(pmic->irq_chip);
-		pmic->irq_chip = NULL;
+		if (pmic->irq_chip) {
+			pm8xxx_irq_exit(pmic->irq_chip);
+			pmic->irq_chip = NULL;
+		}
 	}
 
 	return 0;

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

* Re: [patch] mfd: pm8921: potential NULL dereference in pm8921_remove()
  2013-11-07  8:04 [patch] mfd: pm8921: potential NULL dereference in pm8921_remove() Dan Carpenter
@ 2013-11-07 10:06 ` Lee Jones
  2013-11-07 10:50   ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Lee Jones @ 2013-11-07 10:06 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David Brown, Abhijeet Dharmapurikar, Daniel Walker,
	Bryan Huntsman, Samuel Ortiz, linux-arm-msm, kernel-janitors

Just a thought. If you use `git format-patch` you don't have to
hand-craft the [PATCH] part of the subject line.

> We assume that "pmic" could be NULL and then dereference it two lines
> later.  I fix this by moving the dereference inside the NULL check.
> 
> Fixes: c013f0a56c56 ('mfd: Add pm8xxx irq support')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [patch] mfd: pm8921: potential NULL dereference in pm8921_remove()
  2013-11-07 10:06 ` Lee Jones
@ 2013-11-07 10:50   ` Dan Carpenter
  2013-11-07 11:22     ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2013-11-07 10:50 UTC (permalink / raw)
  To: Lee Jones
  Cc: David Brown, Abhijeet Dharmapurikar, Daniel Walker,
	Bryan Huntsman, Samuel Ortiz, linux-arm-msm, kernel-janitors

On Thu, Nov 07, 2013 at 10:06:09AM +0000, Lee Jones wrote:
> Just a thought. If you use `git format-patch` you don't have to
> hand-craft the [PATCH] part of the subject line.

The lower case [patch] is annoying?

regards,
dan carpenter

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

* Re: [patch] mfd: pm8921: potential NULL dereference in pm8921_remove()
  2013-11-07 10:50   ` Dan Carpenter
@ 2013-11-07 11:22     ` Lee Jones
  2013-11-08  8:48       ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Lee Jones @ 2013-11-07 11:22 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David Brown, Abhijeet Dharmapurikar, Daniel Walker,
	Bryan Huntsman, Samuel Ortiz, linux-arm-msm, kernel-janitors

On Thu, 07 Nov 2013, Dan Carpenter wrote:

> On Thu, Nov 07, 2013 at 10:06:09AM +0000, Lee Jones wrote:
> > Just a thought. If you use `git format-patch` you don't have to
> > hand-craft the [PATCH] part of the subject line.
> 
> The lower case [patch] is annoying?

Not particularly. It didn't even make it to 'nit' status.

The pointer was more to aid you than anything. `git format-patch` is a
nice tool with some really useful options.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [patch] mfd: pm8921: potential NULL dereference in pm8921_remove()
  2013-11-07 11:22     ` Lee Jones
@ 2013-11-08  8:48       ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2013-11-08  8:48 UTC (permalink / raw)
  To: Lee Jones
  Cc: David Brown, Abhijeet Dharmapurikar, Daniel Walker,
	Bryan Huntsman, Samuel Ortiz, linux-arm-msm, kernel-janitors

On Thu, Nov 07, 2013 at 11:22:58AM +0000, Lee Jones wrote:
> On Thu, 07 Nov 2013, Dan Carpenter wrote:
> 
> > On Thu, Nov 07, 2013 at 10:06:09AM +0000, Lee Jones wrote:
> > > Just a thought. If you use `git format-patch` you don't have to
> > > hand-craft the [PATCH] part of the subject line.
> > 
> > The lower case [patch] is annoying?
> 
> Not particularly. It didn't even make it to 'nit' status.
> 
> The pointer was more to aid you than anything. `git format-patch` is a
> nice tool with some really useful options.

It would be hard for me to automate my work flow any more than it
currently is.  :P

regards,
dan carpenter


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

end of thread, other threads:[~2013-11-08  8:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07  8:04 [patch] mfd: pm8921: potential NULL dereference in pm8921_remove() Dan Carpenter
2013-11-07 10:06 ` Lee Jones
2013-11-07 10:50   ` Dan Carpenter
2013-11-07 11:22     ` Lee Jones
2013-11-08  8:48       ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).