* [bug report] net: sun: sungem: use new api ethtool_{get|set}_link_ksettings
@ 2017-03-14 7:50 Dan Carpenter
2017-03-14 21:24 ` Philippe Reynes
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-03-14 7:50 UTC (permalink / raw)
To: kernel-janitors
Hello Philippe Reynes,
This is a semi-automatic email about new static checker warnings.
The patch 92552fdd557: "net: sun: sungem: use new api
ethtool_{get|set}_link_ksettings" from Mar 5, 2017, leads to the
following Smatch complaint:
drivers/net/ethernet/sun/sungem.c:1284 gem_begin_auto_negotiation()
warn: variable dereferenced before check 'ep' (see line 1263)
drivers/net/ethernet/sun/sungem.c
1262 ethtool_convert_link_mode_to_legacy_u32(&advertising,
1263 ep->link_modes.advertising);
^^^^^^^^^^^^^^^^^^^^^^^^^^
Patch adds new dereference.
1264
1265 if (gp->phy_type != phy_mii_mdio0 &&
1266 gp->phy_type != phy_mii_mdio1)
1267 goto non_mii;
1268
1269 /* Setup advertise */
1270 if (found_mii_phy(gp))
1271 features = gp->phy_mii.def->features;
1272 else
1273 features = 0;
1274
1275 advertise = features & ADVERTISE_MASK;
1276 if (gp->phy_mii.advertising != 0)
1277 advertise &= gp->phy_mii.advertising;
1278
1279 autoneg = gp->want_autoneg;
1280 speed = gp->phy_mii.speed;
1281 duplex = gp->phy_mii.duplex;
1282
1283 /* Setup link parameters */
1284 if (!ep)
^^^
Old code assumed it could be NULL.
1285 goto start_aneg;
1286 if (ep->base.autoneg = AUTONEG_ENABLE) {
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [bug report] net: sun: sungem: use new api ethtool_{get|set}_link_ksettings
2017-03-14 7:50 [bug report] net: sun: sungem: use new api ethtool_{get|set}_link_ksettings Dan Carpenter
@ 2017-03-14 21:24 ` Philippe Reynes
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Reynes @ 2017-03-14 21:24 UTC (permalink / raw)
To: kernel-janitors
Hi Dan,
On 3/14/17, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Hello Philippe Reynes,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 92552fdd557: "net: sun: sungem: use new api
> ethtool_{get|set}_link_ksettings" from Mar 5, 2017, leads to the
> following Smatch complaint:
Thanks a lot for reporting this issue. I've send a patch to fix it.
Philippe
> drivers/net/ethernet/sun/sungem.c:1284 gem_begin_auto_negotiation()
> warn: variable dereferenced before check 'ep' (see line 1263)
>
> drivers/net/ethernet/sun/sungem.c
> 1262 ethtool_convert_link_mode_to_legacy_u32(&advertising,
> 1263 ep->link_modes.advertising);
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> Patch adds new dereference.
>
> 1264
> 1265 if (gp->phy_type != phy_mii_mdio0 &&
> 1266 gp->phy_type != phy_mii_mdio1)
> 1267 goto non_mii;
> 1268
> 1269 /* Setup advertise */
> 1270 if (found_mii_phy(gp))
> 1271 features = gp->phy_mii.def->features;
> 1272 else
> 1273 features = 0;
> 1274
> 1275 advertise = features & ADVERTISE_MASK;
> 1276 if (gp->phy_mii.advertising != 0)
> 1277 advertise &= gp->phy_mii.advertising;
> 1278
> 1279 autoneg = gp->want_autoneg;
> 1280 speed = gp->phy_mii.speed;
> 1281 duplex = gp->phy_mii.duplex;
> 1282
> 1283 /* Setup link parameters */
> 1284 if (!ep)
> ^^^
> Old code assumed it could be NULL.
>
> 1285 goto start_aneg;
> 1286 if (ep->base.autoneg = AUTONEG_ENABLE) {
>
> regards,
> dan carpenter
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-14 21:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-14 7:50 [bug report] net: sun: sungem: use new api ethtool_{get|set}_link_ksettings Dan Carpenter
2017-03-14 21:24 ` Philippe Reynes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox