Re: 回覆: [PATCH net-next] net: ftgmac100: Fix potential NULL dereference in error handling

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

 



> > Are you actually saying:
> > 
> >         if (netdev->phydev) {
> >                 /* If we have a PHY, start polling */
> >                 phy_start(netdev->phydev);
> >         }
> > 
> > is wrong, it is guaranteed there is always a phydev?
> > 
> This patch is focus on error handling when using NC-SI at open stage.
> 
>          if (netdev->phydev) {
>                  /* If we have a PHY, start polling */
>                  phy_start(netdev->phydev);
>          }
> 
> This code is used to check the other cases.
> Perhaps, phy-handle or fixed-link property are not added in DTS.

I'm guessing, but i think the static analysers see this condition, and
deducing that phydev might be a NULL. Hence when phy_stop() is called,
it needs the check.

You say the static analyser is wrong, probably because it cannot check
the bigger context. It can be NULL for phy_start() but not for
phy_stop(). Maybe you can give it some more hints?

Dan, is this Smatch? Is it possible to dump the paths through the code
where it thinks it might be NULL?

	Andrew




[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