Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1225882

Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than zero

From Julia Lawall <julia.lawall@lip6.fr>
Newsgroups linux.kernel
Subject Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than zero
Date 2015-09-16 11:30 +0200
Message-ID <q9hcm-ja-19@gated-at.bofh.it> (permalink)
References (3 earlier) <q8Yjp-5Tb-35@gated-at.bofh.it> <q8YCJ-6fP-1@gated-at.bofh.it> <q8YW5-6Co-9@gated-at.bofh.it> <q8YW6-6Co-31@gated-at.bofh.it> <q9h2G-7W-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Wed, 16 Sep 2015, Andrzej Hajda wrote:

> 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?

It seems a bit sloppy, but since the test does have some meaning, maybe it
is OK.

> On the other side it spotted also real bugs, but maybe I can make separate, more
> specific test for such cases.

OK, thanks.

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] coccinelle: tests: unsigned value cannot be lesser than zero Andrzej Hajda <a.hajda@samsung.com> - 2015-09-15 11:30 +0200
  Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero Julia Lawall <julia.lawall@lip6.fr> - 2015-09-15 15:10 +0200
    Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-15 15:20 +0200
      Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero Julia Lawall <julia.lawall@lip6.fr> - 2015-09-15 15:40 +0200
        Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero Andrzej Hajda <a.hajda@samsung.com> - 2015-09-15 16:00 +0200
          Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero Julia Lawall <julia.lawall@lip6.fr> - 2015-09-15 16:00 +0200
            Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero Andrzej Hajda <a.hajda@samsung.com> - 2015-09-16 11:20 +0200
              Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero Julia Lawall <julia.lawall@lip6.fr> - 2015-09-16 11:30 +0200
                [PATCH v2] coccinelle: tests: unsigned value cannot be lesser than zero Andrzej Hajda <a.hajda@samsung.com> - 2015-09-16 15:30 +0200
                Re: [PATCH v2] coccinelle: tests: unsigned value cannot be lesser  than zero Julia Lawall <julia.lawall@lip6.fr> - 2015-09-16 15:40 +0200
                Re: [PATCH v2] coccinelle: tests: unsigned value cannot be lesser  than zero SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-16 21:00 +0200
  Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-15 15:10 +0200
    Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero Andrzej Hajda <a.hajda@samsung.com> - 2015-09-15 15:50 +0200
      Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-15 16:40 +0200
        Re: [Cocci] [PATCH] coccinelle: tests: unsigned value cannot be  lesser than zero Julia Lawall <julia.lawall@lip6.fr> - 2015-09-15 16:50 +0200
          Re: [Cocci] [PATCH] coccinelle: tests: unsigned value cannot be  lesser than zero SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-15 17:00 +0200
      Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than  zero Julia Lawall <julia.lawall@lip6.fr> - 2015-09-18 07:40 +0200
        [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than zero Andrzej Hajda <a.hajda@samsung.com> - 2015-09-21 12:40 +0200
          Re: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser  than zero SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-21 15:10 +0200
            Re: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than  zero Andrzej Hajda <a.hajda@samsung.com> - 2015-09-21 15:40 +0200
              Re: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser  than zero SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-21 16:10 +0200

csiph-web