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


Groups > linux.kernel > #1466358

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-19 14:50 +0200
Message-ID <s7Rpg-5FZ-41@gated-at.bofh.it> (permalink)
References <s1fwl-39b-1@gated-at.bofh.it> <s1jzX-5Fk-11@gated-at.bofh.it> <s7RfA-5Cv-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Fri, 19 Aug 2016, Amitoj Kaur Chawla wrote:

> On Mon, Aug 1, 2016 at 4:53 PM, SF Markus Elfring
> <elfring@users.sourceforge.net> wrote:
> >> +@vz1 depends on patch && !context && !org && !report@
> >> +type T;
> >> +T *d;
> >> +statement S;
> >> +@@
> >> +
> >> +        d =
> >> +-            vmalloc
> >> ++            vzalloc
> >> +             (...);
> >> +        if (!d) S
> >> +-       memset(d, 0, sizeof(T));
> >> +
> >> +@vz2 depends on patch && !context && !org && !report@
> >> +expression d;
> >> +statement S;
> >> +@@
> >> +
> >> +        d =
> >> +-            vmalloc
> >> ++            vzalloc
> >> +             (...);
> >> +        if (!d) S
> >> +-       memset(d, 0, sizeof(*d));
> >
> > I suggest to take another look at a few implementation details.
> >
> > 1. Would it make sense to merge such SmPL rules into one
> >    so that code duplication could be reduced a bit
> >    in such a script?
> >
> > 2. How do you think about to extend the shown check list
> >    with the function "kvm_kvzalloc"?
> >
>
> Hi Markus,
>
> kvm_kvzalloc function doesn't fit the same pattern as the other
> functions in this semantic patch, and is kvm specific, so the
> semantic patch looks fine as is.

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

>
> Thanks,
> Amitoj
>
> > 3. Do you want to maintain a growing (?) function name list manually?
> >
> > Regards,
> > Markus
>

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


Thread

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

csiph-web