Re: [bug report] net: phylink: use legacy_pre_march2020

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 15, 2021 at 02:35:39PM +0300, Dan Carpenter wrote:
> Hello Russell King (Oracle),
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 001f4261fe4d: "net: phylink: use legacy_pre_march2020" from 
> Dec 9, 2021, leads to the following Smatch complaint:
> 
>     drivers/net/phy/phylink.c:823 phylink_change_inband_advert()
>     error: we previously assumed 'pl->pcs_ops' could be null (see line 806)
> 
> drivers/net/phy/phylink.c
>    805	
>    806		if (!pl->pcs_ops && pl->config->legacy_pre_march2020) {
>                     ^^^^^^^^^^^^
> Should this be an ||?

No, the intention is correct, even though it looks a little weird.

We only call phylink_change_inband_advert() if we are in in-band mode,
and in-band mode for non-legacy users requires a PCS. Consequently, if
legacy_pre_march2020 is clear, we have no PCS, and we reach here, then
something is definitely broken.

There isn't an easy way to detect this condition earlier, but we could
do something like:

	if (WARN_ON(!pl->pcs_ops))
		return -EINVAL;

which should be sufficiently noisy for people to do something about.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux