[PATCH net-next 6/8] net: ethernet: annapurna: add wol helpers to the Alpine driver

Antoine Tenart antoine.tenart at free-electrons.com
Fri Feb 10 02:12:47 PST 2017


Hi!

On Mon, Feb 06, 2017 at 11:35:49AM +0000, David Laight wrote:
> From: netdev-owner at vger.kernel.org [mailto:netdev-owner at vger.kernel.org] On Behalf Of Sergei Shtylyov
> > Sent: 03 February 2017 18:22
> > On 02/03/2017 09:12 PM, Antoine Tenart wrote:
> > 
> > > +	if ((adapter) && (adapter->phy_exist) && (adapter->mdio_bus)) {
> > 
> >     Now that's somewhat stupid looking... does the whole driver use this "style"?
> 
> Not only that, in one of the two functions it is followed by:
> 
> +	device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
> 
> Which assumes that 'adapter' is not NULL.
> Some verifiers will detect that as a possible NULL pointer dereference.
> 
> Pointers should only be checked for NULL if there are valid reasons
> why they can be NULL in that code path.
> Getting there with a NULL pointer dues to some race condition isn't one of them.

Totally agree, for the NULL checks and for the useless parenthesis. I'll
try to catch other examples of this in the driver.

Thanks!

Antoine

-- 
Antoine Ténart, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170210/dc32ea36/attachment.sig>


More information about the linux-arm-kernel mailing list