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


Groups > linux.kernel > #1569394 > unrolled thread

[PATCH] phy - Fix possible NULL derefrence.

Started byShailendra Verma <shailendra.v@samsung.com>
First post2017-01-30 06:10 +0100
Last post2017-01-30 06:10 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] phy - Fix possible NULL derefrence. Shailendra Verma <shailendra.v@samsung.com> - 2017-01-30 06:10 +0100

#1569394 — [PATCH] phy - Fix possible NULL derefrence.

FromShailendra Verma <shailendra.v@samsung.com>
Date2017-01-30 06:10 +0100
Subject[PATCH] phy - Fix possible NULL derefrence.
Message-ID<t5co1-8ip-29@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web