Skip to contentSkip to conversation

net: phylink: add suspend/resume support

bug report Dan Carpenter 1 participant 1 message Sep 9, 2021 Kernel janitors

lore
Share & tools
lore
#0 lore 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