[PATCH 3/3] fs/jffs2/dir.c: Use kmemdup

Artem Bityutskiy dedekind1 at gmail.com
Sun Oct 17 23:43:34 EDT 2010


On Sun, 2010-10-17 at 21:56 +0200, Julia Lawall wrote:
> Convert a sequence of kmalloc and memcpy to use kmemdup.
> 
> The semantic patch that performs this transformation is:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression a,flag,len;
> expression arg,e1,e2;
> statement S;
> @@
> 
>   a =
> -  \(kmalloc\|kzalloc\)(len,flag)
> +  kmemdup(arg,len,flag)
>   <... when != a
>   if (a == NULL || ...) S
>   ...>
> - memcpy(a,arg,len+1);
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia at diku.dk>
> 
> ---
>  fs/jffs2/dir.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Picked this one and put to l2-mtd-2.6.git, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list