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: phy: Fix lack of reference count on PHY driver
Date: Tue, 07 Feb 2017 10:50:00 +0000	[thread overview]
Message-ID: <20170207105000.GA30406@mwanda> (raw)

Hello Mao Wenan,

This is a semi-automatic email about new static checker warnings.

The patch cafe8df8b9bc: "net: phy: Fix lack of reference count on PHY 
driver" from Jan 31, 2017, leads to the following Smatch complaint:

drivers/net/phy/phy_device.c:933 phy_attach_direct()
	 warn: variable dereferenced before check 'd->driver' (see line 923)

drivers/net/phy/phy_device.c
   922	
   923		if (!try_module_get(d->driver->owner)) {
                                    ^^^^^^^^^^^
Patch introduces a new dereference.

   924			dev_err(&dev->dev, "failed to get the device driver module\n");
   925			return -EIO;
   926		}
   927	
   928		get_device(d);
   929	
   930		/* Assume that if there is no driver, that it doesn't
   931		 * exist, and we should use the genphy driver.
   932		 */
   933		if (!d->driver) {
                     ^^^^^^^^^
Existing code assumed d->driver could be NULL.

   934			if (phydev->is_c45)
   935				d->driver 
regards,
dan carpenter

             reply	other threads:[~2017-02-07 10:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 10:50 Dan Carpenter [this message]
2017-02-08  1:28 ` [bug report] net: phy: Fix lack of reference count on PHY driver maowenan
2017-02-08  1:55 ` maowenan
2017-02-08  3:29 ` maowenan
2017-02-08  6:10 ` Dan Carpenter
2017-02-08  6:14 ` Dan Carpenter
2017-02-08  6:48 ` maowenan

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=20170207105000.GA30406@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