netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] net: mv643xx_eth: potential NULL dereference in probe()
@ 2013-11-13  7:52 Dan Carpenter
  2013-11-13  8:24 ` Sebastian Hesselbarth
  2013-11-14  8:12 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2013-11-13  7:52 UTC (permalink / raw)
  To: Sebastian Hesselbarth, Jason Gunthorpe; +Cc: netdev, kernel-janitors

We assume that "mp->phy" can be NULL a couple lines before the
dereference.

Fixes: 1cce16d37d0f ('net: mv643xx_eth: Add missing phy_addr_set in DT mode')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 00cd36e..e7905d9 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2890,7 +2890,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 					 PHY_INTERFACE_MODE_GMII);
 		if (!mp->phy)
 			err = -ENODEV;
-		phy_addr_set(mp, mp->phy->addr);
+		else
+			phy_addr_set(mp, mp->phy->addr);
 	} else if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
 		mp->phy = phy_scan(mp, pd->phy_addr);
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-14  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13  7:52 [patch] net: mv643xx_eth: potential NULL dereference in probe() Dan Carpenter
2013-11-13  8:24 ` Sebastian Hesselbarth
2013-11-13 18:00   ` Jason Gunthorpe
2013-11-14  8:12 ` David Miller

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