linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phy - Fix possible NULL derefrence.
       [not found] <CGME20170130045040epcas3p12f5d7e91329798c31ed5daacfb2d96a8@epcas3p1.samsung.com>
@ 2017-01-30  4:50 ` Shailendra Verma
  0 siblings, 0 replies; only message in thread
From: Shailendra Verma @ 2017-01-30  4:50 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, linux-kernel, p.shailesh, ashish.kalra,
	Shailendra Verma, Shailendra Verma

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

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
 drivers/phy/phy-berlin-usb.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/phy/phy-berlin-usb.c b/drivers/phy/phy-berlin-usb.c
index 2017751..c85c516 100644
--- a/drivers/phy/phy-berlin-usb.c
+++ b/drivers/phy/phy-berlin-usb.c
@@ -172,6 +172,11 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
 	struct phy *phy;
 	struct phy_provider *phy_provider;
 
+	if (!match) {
+		dev_err(&pdev->dev, "Error: No device match found\n");
+		return -ENODEV;
+	}
+
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-30  5:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170130045040epcas3p12f5d7e91329798c31ed5daacfb2d96a8@epcas3p1.samsung.com>
2017-01-30  4:50 ` [PATCH] phy - Fix possible NULL derefrence Shailendra Verma

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