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

From: Artem Bityutskiy
Date: Sun Oct 17 2010 - 23:48:30 EST


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@xxxxxxx>
>
> ---
> 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 (ÐÑÑÑÐ ÐÐÑÑÑÐÐÐ)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/