[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170210101247.pxie2wtkbgh4th7f@kwain>
Date: Fri, 10 Feb 2017 11:12:47 +0100
From: Antoine Tenart <antoine.tenart@...e-electrons.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: 'Sergei Shtylyov' <sergei.shtylyov@...entembedded.com>,
Antoine Tenart <antoine.tenart@...e-electrons.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"tsahee@...apurnalabs.com" <tsahee@...apurnalabs.com>,
"rshitrit@...apurnalabs.com" <rshitrit@...apurnalabs.com>,
"saeed@...apurnalabs.com" <saeed@...apurnalabs.com>,
"barak@...apurnalabs.com" <barak@...apurnalabs.com>,
"talz@...apurnalabs.com" <talz@...apurnalabs.com>,
"thomas.petazzoni@...e-electrons.com"
<thomas.petazzoni@...e-electrons.com>,
"arnd@...db.de" <arnd@...db.de>
Subject: Re: [PATCH net-next 6/8] net: ethernet: annapurna: add wol helpers
to the Alpine driver
Hi!
On Mon, Feb 06, 2017 at 11:35:49AM +0000, David Laight wrote:
> From: netdev-owner@...r.kernel.org [mailto:netdev-owner@...r.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
Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)
Powered by blists - more mailing lists