Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1569387

[PATCH] Arch: arm: plat-pxa - Fix possible NULL derefrence.

From Shailendra Verma <shailendra.v@samsung.com>
Newsgroups linux.kernel
Subject [PATCH] Arch: arm: plat-pxa - Fix possible NULL derefrence.
Date 2017-01-30 06:00 +0100
Message-ID <t5cem-804-11@gated-at.bofh.it> (permalink)
References <t5cem-804-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
 arch/arm/plat-pxa/ssp.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
index ba13f79..7d1cd51 100644
--- a/arch/arm/plat-pxa/ssp.c
+++ b/arch/arm/plat-pxa/ssp.c
@@ -204,6 +204,10 @@ static int pxa_ssp_probe(struct platform_device *pdev)
 	if (dev->of_node) {
 		const struct of_device_id *id =
 			of_match_device(of_match_ptr(pxa_ssp_of_ids), dev);
+		if (!id) {
+			dev_err(dev, "Error: No device match found\n");
+			return -ENODEV;
+		}
 		ssp->type = (int) id->data;
 	} else {
 		const struct platform_device_id *id =
-- 
1.7.9.5

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] Arch: arm: plat-pxa - Fix possible NULL derefrence. Shailendra Verma <shailendra.v@samsung.com> - 2017-01-30 06:00 +0100

csiph-web