From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-fx0-f49.google.com ([209.85.161.49]) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1P7ghI-0006xo-PC for linux-mtd@lists.infradead.org; Mon, 18 Oct 2010 03:47:42 +0000 Received: by fxm15 with SMTP id 15so309543fxm.36 for ; Sun, 17 Oct 2010 20:47:38 -0700 (PDT) Subject: Re: [PATCH 3/3] fs/jffs2/dir.c: Use kmemdup From: Artem Bityutskiy To: Julia Lawall In-Reply-To: References: <1287341311-11161-1-git-send-email-julia@diku.dk> <1287341311-11161-4-git-send-email-julia@diku.dk> <1287341849.20968.62.camel@Joe-Laptop> Content-Type: text/plain; charset="UTF-8" Date: Mon, 18 Oct 2010 06:43:34 +0300 Message-ID: <1287373414.1972.25.camel@localhost> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Joe Perches , linux-mtd@lists.infradead.org, David Woodhouse , linux-kernel@vger.kernel.org Reply-To: dedekind1@gmail.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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/) > > // > @@ > 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); > // > > Signed-off-by: Julia Lawall > > --- > 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 (Артём Битюцкий)