[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9e6b813a-bc1a-6a39-904d-5c45f983cd23@gmail.com>
Date: Mon, 22 May 2023 15:09:14 +0100
From: Edward Cree <ecree.xilinx@...il.com>
To: Min-Hua Chen <minhuadotchen@...il.com>, kuba@...nel.org
Cc: alexandre.torgue@...s.st.com, davem@...emloft.net,
edumazet@...gle.com, joabreu@...opsys.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
mcoquelin.stm32@...il.com, netdev@...r.kernel.org,
pabeni@...hat.com, peppe.cavallaro@...com,
simon.horman@...igine.com
Subject: Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32
type values
On 20/05/2023 02:55, Min-Hua Chen wrote:
>> On Fri, 19 May 2023 19:50:28 +0800 Min-Hua Chen wrote:
>>> - if ((p->des0 == 0xffffffff) && (p->des1 == 0xffffffff))
>>> + if (p->des0 == cpu_to_le32(0xffffffff) &&
>>> + p->des1 == cpu_to_le32(0xffffffff))
>>
>> Can you try to fix the sparse tool instead? I believe it already
>> ignores such errors for the constant of 0, maybe it can be taught
>> to ignore all "isomorphic" values?
>>
>
> I downloaded the source code of sparse and I'm afraid that I cannot make
> 0xFFFFFFFF ignored easily. I've tried ~0 instead of 0xFFFFFF,
> but it did not work with current sparse.
>
> 0 is a special case mentioned in [1].
I believe you can do something like
if ((p->des0 == ~(__le32)0) && (p->des1 == ~(__le32)0))
and sparse will accept that, because the cast is allowed under the
special case.
HTH,
-ed
Powered by blists - more mailing lists