From: a.hajda@samsung.com (Andrzej Hajda)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH] coccinelle: tests: unsigned value cannot be lesser than zero
Date: Wed, 16 Sep 2015 11:11:45 +0200 [thread overview]
Message-ID: <55F93251.4010706@samsung.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1509151557040.2537@hadrien>
On 09/15/2015 03:57 PM, Julia Lawall wrote:
>
>
> On Tue, 15 Sep 2015, Andrzej Hajda wrote:
>
>> On 09/15/2015 03:31 PM, Julia Lawall wrote:
>>> On Tue, 15 Sep 2015, SF Markus Elfring wrote:
>>>
>>>>>> v at p
>>>>>> (
>>>>>> *< 0
>>>>>> |
>>>>>> *<= 0
>>>>>> )
>>>>> It does not, and is not intended to, work. The branches of a disjunction
>>>>> should be complete expressions.
>>>> Will the following SmPL approach be more appropriate then?
>>>>
>>>> (
>>>> *v at p < 0
>>>> |
>>>> *v at p <= 0
>>>> )
>>> Actually, all of
>>>
>>> v < 0 (never true)
>>> v <= 0 (same as v == 0)
>>> v >= 0 (always true)
>>>
>>> would seem to merit attention. Andrzej, what do you think?
>>
>> You are right, the 2nd case should be also addressed,
>> such code is misleading.
>> I will prepare then 2nd version of the patch.
>
> It could be reasonable to change the options to --all-includes? Although
> it could be somewhat slow.
I have tested the patch with 'v <= 0', it spotted hundreds places with this
check. It seems to be quite common practice to use such checks with counters,
iterators, quantities, range checking. In fact it is negation of 'v > 0' which
seems to be acceptable even if it really means 'v != 0'. So maybe we should not
warn about it? What do you think?
On the other side it spotted also real bugs, but maybe I can make separate, more
specific test for such cases.
Regards
Andrzej
>
> julia
>
>>
>> Regards
>> Andrzej
>>
>>>
>>> julia
>>>
>>>
>>>> Regards,
>>>> Markus
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
>>>> the body of a message to majordomo at vger.kernel.org
>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>>
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
WARNING: multiple messages have this Message-ID (diff)
From: Andrzej Hajda <a.hajda@samsung.com>
To: cocci@systeme.lip6.fr
Subject: Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than zero
Date: Wed, 16 Sep 2015 09:11:45 +0000 [thread overview]
Message-ID: <55F93251.4010706@samsung.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1509151557040.2537@hadrien>
On 09/15/2015 03:57 PM, Julia Lawall wrote:
>
>
> On Tue, 15 Sep 2015, Andrzej Hajda wrote:
>
>> On 09/15/2015 03:31 PM, Julia Lawall wrote:
>>> On Tue, 15 Sep 2015, SF Markus Elfring wrote:
>>>
>>>>>> v@p
>>>>>> (
>>>>>> *< 0
>>>>>> |
>>>>>> *<= 0
>>>>>> )
>>>>> It does not, and is not intended to, work. The branches of a disjunction
>>>>> should be complete expressions.
>>>> Will the following SmPL approach be more appropriate then?
>>>>
>>>> (
>>>> *v@p < 0
>>>> |
>>>> *v@p <= 0
>>>> )
>>> Actually, all of
>>>
>>> v < 0 (never true)
>>> v <= 0 (same as v = 0)
>>> v >= 0 (always true)
>>>
>>> would seem to merit attention. Andrzej, what do you think?
>>
>> You are right, the 2nd case should be also addressed,
>> such code is misleading.
>> I will prepare then 2nd version of the patch.
>
> It could be reasonable to change the options to --all-includes? Although
> it could be somewhat slow.
I have tested the patch with 'v <= 0', it spotted hundreds places with this
check. It seems to be quite common practice to use such checks with counters,
iterators, quantities, range checking. In fact it is negation of 'v > 0' which
seems to be acceptable even if it really means 'v != 0'. So maybe we should not
warn about it? What do you think?
On the other side it spotted also real bugs, but maybe I can make separate, more
specific test for such cases.
Regards
Andrzej
>
> julia
>
>>
>> Regards
>> Andrzej
>>
>>>
>>> julia
>>>
>>>
>>>> Regards,
>>>> Markus
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>>
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
WARNING: multiple messages have this Message-ID (diff)
From: Andrzej Hajda <a.hajda@samsung.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: SF Markus Elfring <elfring@users.sourceforge.net>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Gilles Muller <Gilles.Muller@lip6.fr>,
Joe Perches <joe@perches.com>,
Nicolas Palix <nicolas.palix@imag.fr>,
Michal Marek <mmarek@suse.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
cocci@systeme.lip6.fr
Subject: Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than zero
Date: Wed, 16 Sep 2015 11:11:45 +0200 [thread overview]
Message-ID: <55F93251.4010706@samsung.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1509151557040.2537@hadrien>
On 09/15/2015 03:57 PM, Julia Lawall wrote:
>
>
> On Tue, 15 Sep 2015, Andrzej Hajda wrote:
>
>> On 09/15/2015 03:31 PM, Julia Lawall wrote:
>>> On Tue, 15 Sep 2015, SF Markus Elfring wrote:
>>>
>>>>>> v@p
>>>>>> (
>>>>>> *< 0
>>>>>> |
>>>>>> *<= 0
>>>>>> )
>>>>> It does not, and is not intended to, work. The branches of a disjunction
>>>>> should be complete expressions.
>>>> Will the following SmPL approach be more appropriate then?
>>>>
>>>> (
>>>> *v@p < 0
>>>> |
>>>> *v@p <= 0
>>>> )
>>> Actually, all of
>>>
>>> v < 0 (never true)
>>> v <= 0 (same as v == 0)
>>> v >= 0 (always true)
>>>
>>> would seem to merit attention. Andrzej, what do you think?
>>
>> You are right, the 2nd case should be also addressed,
>> such code is misleading.
>> I will prepare then 2nd version of the patch.
>
> It could be reasonable to change the options to --all-includes? Although
> it could be somewhat slow.
I have tested the patch with 'v <= 0', it spotted hundreds places with this
check. It seems to be quite common practice to use such checks with counters,
iterators, quantities, range checking. In fact it is negation of 'v > 0' which
seems to be acceptable even if it really means 'v != 0'. So maybe we should not
warn about it? What do you think?
On the other side it spotted also real bugs, but maybe I can make separate, more
specific test for such cases.
Regards
Andrzej
>
> julia
>
>>
>> Regards
>> Andrzej
>>
>>>
>>> julia
>>>
>>>
>>>> Regards,
>>>> Markus
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>>
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-09-16 9:11 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-15 9:27 [Cocci] [PATCH] coccinelle: tests: unsigned value cannot be lesser than zero Andrzej Hajda
2015-09-15 9:27 ` Andrzej Hajda
2015-09-15 13:01 ` [Cocci] " SF Markus Elfring
2015-09-15 13:01 ` SF Markus Elfring
2015-09-15 13:01 ` SF Markus Elfring
2015-09-15 13:07 ` [Cocci] " Julia Lawall
2015-09-15 13:07 ` Julia Lawall
2015-09-15 13:07 ` Julia Lawall
2015-09-15 13:16 ` [Cocci] " SF Markus Elfring
2015-09-15 13:16 ` SF Markus Elfring
2015-09-15 13:16 ` SF Markus Elfring
2015-09-15 13:31 ` [Cocci] " Julia Lawall
2015-09-15 13:31 ` Julia Lawall
2015-09-15 13:31 ` Julia Lawall
2015-09-15 13:51 ` [Cocci] " Andrzej Hajda
2015-09-15 13:51 ` Andrzej Hajda
2015-09-15 13:51 ` Andrzej Hajda
2015-09-15 13:57 ` [Cocci] " Julia Lawall
2015-09-15 13:57 ` Julia Lawall
2015-09-15 13:57 ` Julia Lawall
2015-09-16 9:11 ` Andrzej Hajda [this message]
2015-09-16 9:11 ` Andrzej Hajda
2015-09-16 9:11 ` Andrzej Hajda
2015-09-16 9:25 ` [Cocci] " Julia Lawall
2015-09-16 9:25 ` Julia Lawall
2015-09-16 9:25 ` Julia Lawall
2015-09-16 13:22 ` [Cocci] [PATCH v2] " Andrzej Hajda
2015-09-16 13:22 ` Andrzej Hajda
2015-09-16 13:33 ` [Cocci] " Julia Lawall
2015-09-16 13:33 ` Julia Lawall
2015-09-16 18:56 ` [Cocci] " SF Markus Elfring
2015-09-16 18:56 ` SF Markus Elfring
2015-09-16 18:56 ` SF Markus Elfring
2015-09-15 13:42 ` [Cocci] [PATCH] " Andrzej Hajda
2015-09-15 13:42 ` Andrzej Hajda
2015-09-15 13:42 ` Andrzej Hajda
2015-09-15 14:36 ` [Cocci] " SF Markus Elfring
2015-09-15 14:36 ` SF Markus Elfring
2015-09-15 14:36 ` SF Markus Elfring
2015-09-15 14:43 ` [Cocci] " Julia Lawall
2015-09-15 14:43 ` Julia Lawall
2015-09-15 14:43 ` Julia Lawall
2015-09-15 14:53 ` SF Markus Elfring
2015-09-15 14:53 ` SF Markus Elfring
2015-09-15 14:53 ` SF Markus Elfring
2015-09-18 5:35 ` Julia Lawall
2015-09-18 5:35 ` Julia Lawall
2015-09-18 5:35 ` Julia Lawall
2015-09-21 10:37 ` [Cocci] [PATCH v3] " Andrzej Hajda
2015-09-21 10:37 ` Andrzej Hajda
2015-09-21 10:37 ` Andrzej Hajda
2015-09-21 13:02 ` [Cocci] " SF Markus Elfring
2015-09-21 13:02 ` SF Markus Elfring
2015-09-21 13:02 ` SF Markus Elfring
2015-09-21 13:34 ` [Cocci] " Andrzej Hajda
2015-09-21 13:34 ` Andrzej Hajda
2015-09-21 13:34 ` Andrzej Hajda
2015-09-21 14:06 ` [Cocci] " SF Markus Elfring
2015-09-21 14:06 ` SF Markus Elfring
2015-09-21 14:06 ` SF Markus Elfring
2015-09-22 15:27 ` [Cocci] " SF Markus Elfring
2015-09-22 15:27 ` SF Markus Elfring
2015-09-22 15:27 ` SF Markus Elfring
2015-09-23 7:34 ` [Cocci] " Andrzej Hajda
2015-09-23 7:34 ` Andrzej Hajda
2015-09-23 7:34 ` Andrzej Hajda
2015-09-23 15:17 ` [Cocci] " SF Markus Elfring
2015-09-23 15:17 ` SF Markus Elfring
2015-09-23 15:17 ` SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55F93251.4010706@samsung.com \
--to=a.hajda@samsung.com \
--cc=cocci@systeme.lip6.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.