Messages in this thread | | | Subject | Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values | From | Edward Cree <> | Date | Mon, 22 May 2023 15:09:14 +0100 |
| |
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
| |