[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4F7AD1BB-DF5D-4391-88F4-F0599A2AF90C@intel.com>
Date: Wed, 25 Nov 2015 17:12:35 +0000
From: "Rustad, Mark D" <mark.d.rustad@...el.com>
To: "Zhang, Helin" <helin.zhang@...el.com>
CC: "Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
"David S. Miller" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"nhorman@...hat.com" <nhorman@...hat.com>,
"sassmann@...hat.com" <sassmann@...hat.com>,
"jogreene@...hat.com" <jogreene@...hat.com>,
"Joe Perches" <joe@...ches.com>
Subject: Re: [net-next 06/16] i40e: Properly cast type for arithmetic
Joe Perches <joe@...ches.com> wrote:
> On Wed, 2015-11-25 at 02:46 -0800, Jeff Kirsher wrote:
>> On Tue, 2015-11-24 at 16:43 -0800, Joe Perches wrote:
>>> On Tue, 2015-11-24 at 16:04 -0800, Jeff Kirsher wrote:
>>>> From: Helin Zhang <helin.zhang@...el.com>
>>>>
>>>> Pointer of type void * shouldn't be used in arithmetic, which may
>>>> result in compilation error. Casting of (u8 *) can be added to fix
>>>> that.
>>>
>>> void * arithmetic is used quite frequently in the kernel.
>>>
>>> What compiler emits an error?
>>
>> When you use the gcc -Wpointer-arith, it generates the warning.
>
> make W=3 does that
>
> $ make help
> [...]
> make W=n [targets] Enable extra gcc checks, n=1,2,3 where
> 1: warnings which may be relevant and do not occur too often
> 2: warnings which occur quite often but may still be relevant
> 3: more obscure warnings, can most likely be ignored
>
> but I think it should be ignored.
Yes. That doesn't mean that -Wpointer-arith can't catch other possible errors that may be worth fixing, but this particular type is an accepted usage in the kernel and so should be ignored - unless you find something logically wrong, which does not seem to be the case here at all.
If one cared about portability to other compilers that treat void * very differently in this usage, then you would want to deal with all of these. That is not the case with the kernel.
--
Mark Rustad, Networking Division, Intel Corporation
Download attachment "signature.asc" of type "application/pgp-signature" (842 bytes)
Powered by blists - more mailing lists