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


Groups > linux.kernel > #1224870 > unrolled thread

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

Started byAndrzej Hajda <a.hajda@samsung.com>
First post2015-09-15 11:30 +0200
Last post2015-09-23 17:20 +0200
Articles 4 on this page of 24 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [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
                Re: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser  than zero SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-22 17:30 +0200
                  Re: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than  zero Andrzej Hajda <a.hajda@samsung.com> - 2015-09-23 09:40 +0200
                    Re: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser  than zero SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-23 17:20 +0200

Page 2 of 2 — ← Prev page 1 [2]


#1229394 — Re: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than zero

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-09-21 16:10 +0200
SubjectRe: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than zero
Message-ID<qb9X5-rF-35@gated-at.bofh.it>
In reply to#1229318
>> * Reuse of "long int"?
> If you mean adding int to 'unsigned long [long]' types, it does not work.

I am surprised.


> For some reason it works only without adding int after long.

The  Coccinelle software should support the term "generic_ctype" from
the SmPL grammar so far, shouldn't it?
http://coccinelle.lip6.fr/docs/main_grammar005.html#ctype


>> * Splitting of the suggested SmPL rule so that each source code check
>> will be connected with appropriate warning messages.
> Personally I prefer one message as it is more compact

It might look convenient to combine a few source code checks.


> and fits quite well in both cases,

I got an other impression.


> but I have no strong fillings with separate message for each case.

* v@p < 0
  Find places where this condition will always be false.

*v@p >= 0
  Find places where this condition will always be true.


Will it help to distinguish these special cases also in your SmPL script
strictly?

Regards,
Markus
--
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/

[toc] | [prev] | [next] | [standalone]


#1230334 — Re: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than zero

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-09-22 17:30 +0200
SubjectRe: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than zero
Message-ID<qbxG3-P2-47@gated-at.bofh.it>
In reply to#1229318
> If you mean adding int to 'unsigned long [long]' types, it does not work.
> For some reason it works only without adding int after long.

Do you get any error message for this SmPL approach?
With which source files do you try the extended SmPL script out?

Regards,
Markus
--
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/

[toc] | [prev] | [next] | [standalone]


#1231197 — Re: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than zero

FromAndrzej Hajda <a.hajda@samsung.com>
Date2015-09-23 09:40 +0200
SubjectRe: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than zero
Message-ID<qbMOK-5WP-13@gated-at.bofh.it>
In reply to#1230334
On 09/22/2015 05:27 PM, SF Markus Elfring wrote:
>> If you mean adding int to 'unsigned long [long]' types, it does not work.
>> For some reason it works only without adding int after long.
> Do you get any error message for this SmPL approach?
> With which source files do you try the extended SmPL script out?
>
> Regards,
> Markus
>
No, spatch just does not find everything it should. Sample below:
--- test.cocci
virtual context

@r depends on context@
{unsigned char, unsigned short int, unsigned int, unsigned long int, unsigned
long long, size_t} v;
@@

*v
--- test.c
void f()
{
    unsigned long ul;
    unsigned long int uli;
    unsigned long long ull;
    unsigned long long int ulli;

    ul;
    uli;
    ull;
    ulli;
}
---
In the example above spatch finds ull, ulli, but not ul and uli.
If you add int to unsigned long long, it won't find anything.

Regards
Andrzej


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

[toc] | [prev] | [next] | [standalone]


#1231501 — Re: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than zero

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-09-23 17:20 +0200
SubjectRe: [PATCH v3] coccinelle: tests: unsigned value cannot be lesser than zero
Message-ID<qbTZU-7VV-7@gated-at.bofh.it>
In reply to#1231197
> In the example above spatch finds ull, ulli, but not ul and uli.
> If you add int to unsigned long long, it won't find anything.

I suggest to take another look at the use of type modifiers
in the semantic patch language. It seems that it matters occasionally
to specify them explicitly.

How do you think about to reuse a SmPL script like the following?


@find_unsigned@
typedef _Bool, bool, u8, u16, u32, u64;
{
unsigned,
unsigned char,
unsigned int,
unsigned short,
unsigned short int,
unsigned long,
unsigned long int,
unsigned long long,
unsigned long long int,
size_t,
_Bool,
bool,
u8,
u16,
u32,
u64
} var;
@@
*var


Regards,
Markus
--
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/

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web