* Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values
@ 2023-05-20 1:55 ` Min-Hua Chen
0 siblings, 0 replies; 16+ messages in thread
From: Min-Hua Chen @ 2023-05-20 1:55 UTC (permalink / raw)
To: kuba
Cc: alexandre.torgue, davem, edumazet, joabreu, linux-arm-kernel,
linux-kernel, linux-stm32, mcoquelin.stm32, minhuadotchen, netdev,
pabeni, peppe.cavallaro, simon.horman
Hi Jakub,
>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].
"""
One small note: the constant integer “0” is special.
You can use a constant zero as a bitwise integer type without
sparse ever complaining. This is because “bitwise” (as the name
implies) was designed for making sure that bitwise types don’t
get mixed up (little-endian vs big-endian vs cpu-endian vs whatever),
and there the constant “0” really _is_ special.
"""
For 0xFFFFFFFF, it may look like a false alarm, but we can silence the
sparse warning by taking a fix like mine and people can keep working on
other sparse warnings easier.
(There are around 7000 sparse warning in ARCH=arm64 defconfig build and
sometimes it is hard to remember all the false alarm cases)
Could you consider taking this patch, please?
>
>By "isomorphic" I mean that 0xffffffff == cpu_to_le32(0xffffffff)
>so there's no point complaining.
thanks,
Min-Hua
[1] https://www.kernel.org/doc/html/v4.12/dev-tools/sparse.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values
2023-05-20 1:55 ` Min-Hua Chen
@ 2023-05-20 4:04 ` Jakub Kicinski
-1 siblings, 0 replies; 16+ messages in thread
From: Jakub Kicinski @ 2023-05-20 4:04 UTC (permalink / raw)
To: Min-Hua Chen
Cc: alexandre.torgue, davem, edumazet, joabreu, linux-arm-kernel,
linux-kernel, linux-stm32, mcoquelin.stm32, netdev, pabeni,
peppe.cavallaro, simon.horman
On Sat, 20 May 2023 09:55:27 +0800 Min-Hua Chen wrote:
> >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].
>
> """
> One small note: the constant integer “0” is special.
> You can use a constant zero as a bitwise integer type without
> sparse ever complaining. This is because “bitwise” (as the name
> implies) was designed for making sure that bitwise types don’t
> get mixed up (little-endian vs big-endian vs cpu-endian vs whatever),
> and there the constant “0” really _is_ special.
> """
>
> For 0xFFFFFFFF, it may look like a false alarm, but we can silence the
> sparse warning by taking a fix like mine and people can keep working on
> other sparse warnings easier.
We can make working with sparse easier by making sure it doesn't
generate false positive warnings :\
> (There are around 7000 sparse warning in ARCH=arm64 defconfig build and
> sometimes it is hard to remember all the false alarm cases)
>
> Could you consider taking this patch, please?
No. We don't take patches to address false positive static
checker warnings.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values
@ 2023-05-20 4:04 ` Jakub Kicinski
0 siblings, 0 replies; 16+ messages in thread
From: Jakub Kicinski @ 2023-05-20 4:04 UTC (permalink / raw)
To: Min-Hua Chen
Cc: alexandre.torgue, davem, edumazet, joabreu, linux-arm-kernel,
linux-kernel, linux-stm32, mcoquelin.stm32, netdev, pabeni,
peppe.cavallaro, simon.horman
On Sat, 20 May 2023 09:55:27 +0800 Min-Hua Chen wrote:
> >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].
>
> """
> One small note: the constant integer “0” is special.
> You can use a constant zero as a bitwise integer type without
> sparse ever complaining. This is because “bitwise” (as the name
> implies) was designed for making sure that bitwise types don’t
> get mixed up (little-endian vs big-endian vs cpu-endian vs whatever),
> and there the constant “0” really _is_ special.
> """
>
> For 0xFFFFFFFF, it may look like a false alarm, but we can silence the
> sparse warning by taking a fix like mine and people can keep working on
> other sparse warnings easier.
We can make working with sparse easier by making sure it doesn't
generate false positive warnings :\
> (There are around 7000 sparse warning in ARCH=arm64 defconfig build and
> sometimes it is hard to remember all the false alarm cases)
>
> Could you consider taking this patch, please?
No. We don't take patches to address false positive static
checker warnings.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values
2023-05-20 4:04 ` Jakub Kicinski
@ 2023-05-20 7:34 ` Min-Hua Chen
-1 siblings, 0 replies; 16+ messages in thread
From: Min-Hua Chen @ 2023-05-20 7:34 UTC (permalink / raw)
To: kuba
Cc: alexandre.torgue, davem, edumazet, joabreu, linux-arm-kernel,
linux-kernel, linux-stm32, mcoquelin.stm32, minhuadotchen, netdev,
pabeni, peppe.cavallaro, simon.horman
Hi Jakub,
>We can make working with sparse easier by making sure it doesn't
>generate false positive warnings :\
It will be good if sparse can handle this case correctly.
>
>> (There are around 7000 sparse warning in ARCH=arm64 defconfig build and
>> sometimes it is hard to remember all the false alarm cases)
>>
>> Could you consider taking this patch, please?
>
>No. We don't take patches to address false positive static
>checker warnings.
No problem.
thanks,
Min-Hua
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values
@ 2023-05-20 7:34 ` Min-Hua Chen
0 siblings, 0 replies; 16+ messages in thread
From: Min-Hua Chen @ 2023-05-20 7:34 UTC (permalink / raw)
To: kuba
Cc: alexandre.torgue, davem, edumazet, joabreu, linux-arm-kernel,
linux-kernel, linux-stm32, mcoquelin.stm32, minhuadotchen, netdev,
pabeni, peppe.cavallaro, simon.horman
Hi Jakub,
>We can make working with sparse easier by making sure it doesn't
>generate false positive warnings :\
It will be good if sparse can handle this case correctly.
>
>> (There are around 7000 sparse warning in ARCH=arm64 defconfig build and
>> sometimes it is hard to remember all the false alarm cases)
>>
>> Could you consider taking this patch, please?
>
>No. We don't take patches to address false positive static
>checker warnings.
No problem.
thanks,
Min-Hua
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values
2023-05-20 1:55 ` Min-Hua Chen
@ 2023-05-22 14:09 ` Edward Cree
-1 siblings, 0 replies; 16+ messages in thread
From: Edward Cree @ 2023-05-22 14:09 UTC (permalink / raw)
To: Min-Hua Chen, kuba
Cc: alexandre.torgue, davem, edumazet, joabreu, linux-arm-kernel,
linux-kernel, linux-stm32, mcoquelin.stm32, netdev, pabeni,
peppe.cavallaro, simon.horman
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values
@ 2023-05-22 14:09 ` Edward Cree
0 siblings, 0 replies; 16+ messages in thread
From: Edward Cree @ 2023-05-22 14:09 UTC (permalink / raw)
To: Min-Hua Chen, kuba
Cc: alexandre.torgue, davem, edumazet, joabreu, linux-arm-kernel,
linux-kernel, linux-stm32, mcoquelin.stm32, netdev, pabeni,
peppe.cavallaro, simon.horman
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
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values
2023-05-22 14:09 ` Edward Cree
@ 2023-05-22 15:36 ` Min-Hua Chen
-1 siblings, 0 replies; 16+ messages in thread
From: Min-Hua Chen @ 2023-05-22 15:36 UTC (permalink / raw)
To: ecree.xilinx
Cc: alexandre.torgue, davem, edumazet, joabreu, kuba,
linux-arm-kernel, linux-kernel, linux-stm32, mcoquelin.stm32,
minhuadotchen, netdev, pabeni, peppe.cavallaro, simon.horman
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] net: stmmac: compare p->des0 and p->des1 with __le32 type values
@ 2023-05-22 15:36 ` Min-Hua Chen
0 siblings, 0 replies; 16+ messages in thread
From: Min-Hua Chen @ 2023-05-22 15:36 UTC (permalink / raw)
To: ecree.xilinx
Cc: alexandre.torgue, davem, edumazet, joabreu, kuba,
linux-arm-kernel, linux-kernel, linux-stm32, mcoquelin.stm32,
minhuadotchen, netdev, pabeni, peppe.cavallaro, simon.horman
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
^ permalink raw reply [flat|nested] 16+ messages in thread