Skip to contentSkip to conversation

mfd: qcom_rpm: fix a possible NULL dereference

PATCH Applied LABBE Corentin 2 participants 2 messages Nov 12, 2015 – Nov 24, 2015

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: qcom_rpm: fix a possible NULL dereference

of_match_device could return NULL, and so cause a NULL pointer dereference later.

---
 drivers/mfd/qcom_rpm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mfd/qcom_rpm.c +2 -0
index 207a3bd..1be47ad 100644
@@ -495,6 +495,8 @@ static int qcom_rpm_probe(struct platform_device *pdev)
 	}
 
 	match = of_match_device(qcom_rpm_of_match, &pdev->dev);
+	if (!match)
+		return -ENODEV;
 	rpm->data = match->data;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Signature · 1 line
2.4.10
Applied
#1 lore raw
Quoted 7 lines · LABBE Corentin

of_match_device could return NULL, and so cause a NULL pointer dereference later.

---
 drivers/mfd/qcom_rpm.c | 2 ++
 1 file changed, 2 insertions(+)

Applied, thanks.

Quoted 13 lines
drivers/mfd/qcom_rpm.c +2 -0
index 207a3bd..1be47ad 100644
@@ -495,6 +495,8 @@ static int qcom_rpm_probe(struct platform_device *pdev)
 	}
 
 	match = of_match_device(qcom_rpm_of_match, &pdev->dev);
+	if (!match)
+		return -ENODEV;
 	rpm->data = match->data;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog