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


Groups > linux.kernel > #1453183

Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and memset with zalloc functions

From Julia Lawall <julia.lawall@lip6.fr>
Newsgroups linux.kernel
Subject Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and memset with zalloc functions
Date 2016-08-01 14:40 +0200
Message-ID <s1kFH-6jL-1@gated-at.bofh.it> (permalink)
References (1 earlier) <s1jzX-5Fk-11@gated-at.bofh.it> <s1jJD-5J0-7@gated-at.bofh.it> <s1k2Z-5PD-9@gated-at.bofh.it> <s1kcG-68q-11@gated-at.bofh.it> <s1kw6-6gg-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Mon, 1 Aug 2016, SF Markus Elfring wrote:

> >> How do you think about the following SmPL script example?
> >>
> >> @vz_combined
> >>  depends on patch && !context && !org && !report@
> >> type T;
> >> T* pointer;
> >> +statement S;
> >> expression express;
> >> @@
> >>  pointer =
> >> -          vmalloc
> >> +          vzalloc
> >>            (...);
> >>  if (!d)
> >>     S
> >> -memset(d, 0, sizeof(
> >> (
> >> -T
> >> |
> >> -*(express)
> >> )
> >> -));

Actually, this is a mess.  pointer, d, and express are all supposed to be
the same thing, as they were in the original rule.

Furthermore, this shows a reason why the original rule was better.  If you
say T *pointer, then you require that Coccinelle can find the type
sofficiently to know that it is a pointer.  There was no such constraint
in the sizeof(*d) variant of the original rule.

> > The performance issue is that disjunctions on expressions, eg (A | B), are
> > implemented as (A | (!A & B)), ie with a negation of all the previous
> > options &d with each option.  So it is better to avoid very large
> > disjunctions on expressions.
>
> Is the suggested SmPL disjunction still small enough for this concern?

2 elements is OK.

julia

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


Thread

[PATCH v3] Coccinelle: Script to replace allocate and memset with  zalloc functions Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-08-01 09:10 +0200
  Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and  memset with zalloc functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-01 13:30 +0200
    Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and  memset with zalloc functions Julia Lawall <julia.lawall@lip6.fr> - 2016-08-01 13:40 +0200
      Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and  memset with zalloc functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-01 14:00 +0200
        Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and  memset with zalloc functions Julia Lawall <julia.lawall@lip6.fr> - 2016-08-01 14:10 +0200
          Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and  memset with zalloc functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-01 14:30 +0200
            Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and  memset with zalloc functions Julia Lawall <julia.lawall@lip6.fr> - 2016-08-01 14:40 +0200
              Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and  memset with zalloc functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-01 14:50 +0200

csiph-web