All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] net: phy: Fix lack of reference count on PHY driver
@ 2017-02-07 10:50 Dan Carpenter
  2017-02-08  1:28 ` maowenan
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Dan Carpenter @ 2017-02-07 10:50 UTC (permalink / raw)
  To: kernel-janitors

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-02-08  6:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 10:50 [bug report] net: phy: Fix lack of reference count on PHY driver Dan Carpenter
2017-02-08  1:28 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.