lkml.org 
[lkml]   [2023]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values
From
Date
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

\
 
 \ /
  Last update: 2023-05-22 18:48    [W:0.379 / U:1.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site