lkml.org 
[lkml]   [2016]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and memset with zalloc functions
From
Date
> +@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"?

3. Do you want to maintain a growing (?) function name list manually?

Regards,
Markus

\
 
 \ /
  Last update: 2016-08-01 14:01    [W:0.128 / U:1.852 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site