Skip to contentSkip to conversation

mfd: pm8921: potential NULL dereference in pm8921_remove()

PATCH In review Dan Carpenter 2 participants 5 messages Nov 7, 2013 – Nov 8, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: pm8921: potential NULL dereference in pm8921_remove()

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')
drivers/mfd/pm8921-core.c +5 -4
index a6841f7..484fe66 100644
@@ -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;
#1 lore raw

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

Quoted 5 lines

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')

Patch applied thanks.

Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 2 lines · Lee Jones

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

#3 lore raw
Quoted 5 lines · Dan Carpenter
Quoted 2 lines · Lee Jones

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.

Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
Quoted 6 lines · Lee Jones
Quoted 4 lines · Dan Carpenter
Quoted 2 lines · Lee Jones

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

Quoted 6 lines
Quoted 1 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