[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230522153615.247577-1-minhuadotchen@gmail.com>
Date: Mon, 22 May 2023 23:36:15 +0800
From: Min-Hua Chen <minhuadotchen@...il.com>
To: ecree.xilinx@...il.com
Cc: alexandre.torgue@...s.st.com,
davem@...emloft.net,
edumazet@...gle.com,
joabreu@...opsys.com,
kuba@...nel.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
mcoquelin.stm32@...il.com,
minhuadotchen@...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
hi Edward,
>>> 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
I tested ~(__le32)0 and it worked: sparse accpets this.
Thanks for sharing this.
cheers,
Min-Hua
Powered by blists - more mailing lists