Commit e74bad6b authored by Philippe Reynes's avatar Philippe Reynes Committed by David S. Miller

net: sun: sungem: rix a possible null dereference

The function gem_begin_auto_negotiation dereference
the pointer ep before testing if it's null. This
patch add a check on ep before dereferencing it.

Fixes: 92552fdd ("net: sun: sungem: use new api
ethtool_{get|set}_link_ksettings")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c5b71e63
...@@ -1259,8 +1259,9 @@ static void gem_begin_auto_negotiation(struct gem *gp, ...@@ -1259,8 +1259,9 @@ static void gem_begin_auto_negotiation(struct gem *gp,
int duplex; int duplex;
u32 advertising; u32 advertising;
ethtool_convert_link_mode_to_legacy_u32(&advertising, if (ep)
ep->link_modes.advertising); ethtool_convert_link_mode_to_legacy_u32(
&advertising, ep->link_modes.advertising);
if (gp->phy_type != phy_mii_mdio0 && if (gp->phy_type != phy_mii_mdio0 &&
gp->phy_type != phy_mii_mdio1) gp->phy_type != phy_mii_mdio1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment