public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] net: sun: sungem: use new api ethtool_{get|set}_link_ksettings
Date: Tue, 14 Mar 2017 07:50:10 +0000	[thread overview]
Message-ID: <20170314075010.GA6022@mwanda> (raw)

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

             reply	other threads:[~2017-03-14  7:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14  7:50 Dan Carpenter [this message]
2017-03-14 21:24 ` [bug report] net: sun: sungem: use new api ethtool_{get|set}_link_ksettings Philippe Reynes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170314075010.GA6022@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox