public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: rmk+kernel@armlinux.org.uk
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] net: phylink: add suspend/resume support
Date: Thu, 9 Sep 2021 12:05:02 +0300	[thread overview]
Message-ID: <20210909090502.GA24126@kili> (raw)

Hello Russell King (Oracle),

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

The patch f97493657c63: "net: phylink: add suspend/resume support" 
from Sep 7, 2021, leads to the following Smatch complaint:

    drivers/net/phy/phylink.c:1336 phylink_suspend()
    error: we previously assumed 'pl->netdev' could be null (see line 1325)

drivers/net/phy/phylink.c
  1324	
  1325		if (mac_wol && (!pl->netdev || pl->netdev->wol_enabled)) {
                                 ^^^^^^^^^^
This checks for NULL

  1326			/* Wake-on-Lan enabled, MAC handling */
  1327			mutex_lock(&pl->state_mutex);
  1328	
  1329			/* Stop the resolver bringing the link up */
  1330			__set_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state);
  1331	
  1332			/* Disable the carrier, to prevent transmit timeouts,
  1333			 * but one would hope all packets have been sent. This
  1334			 * also means phylink_resolve() will do nothing.
  1335			 */
  1336			netif_carrier_off(pl->netdev);
                                          ^^^^^^^^^^
But there is an unchecked dereference inside the netif_carrier_off()
function.

  1337	
  1338			/* We do not call mac_link_down() here as we want the

regards,
dan carpenter

                 reply	other threads:[~2021-09-09  9:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210909090502.GA24126@kili \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /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