net: mv643xx_eth: potential NULL dereference in probe()
PATCH 1/1 net: mv643xx_eth: potential NULL dereference in probe()
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 <[email protected]>
drivers/net/ethernet/marvell/mv643xx_eth.c +2 -1
@@ -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);
Quoted 5 lines · Dan Carpenter
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 <[email protected]>
Quoted 15 lines
drivers/net/ethernet/marvell/mv643xx_eth.c +2
-1@@ -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);
Jason Gunthorpe
Acked-byQuoted 8 lines · Sebastian Hesselbarth
Quoted 5 lines · Dan Carpenter
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 <[email protected]>
Acked-by Jason Gunthorpe <[email protected]>
My bad, I missed this possibility.
Jason
From: Dan Carpenter <[email protected]>
Date: Wed, 13 Nov 2013 10:52:47 +0300
Quoted 5 lines
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 <[email protected]>
Applied, thanks.