Return-path: Received: from smtp.nokia.com ([192.100.105.134]:35878 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754357Ab0EQIAp (ORCPT ); Mon, 17 May 2010 04:00:45 -0400 Subject: Re: [PATCH 12/37] drivers/net/wireless/wl12xx: Use kmemdup From: Luciano Coelho To: ext Julia Lawall Cc: "John W. Linville" , "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kernel-janitors@vger.kernel.org" In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Mon, 17 May 2010 10:59:37 +0300 Message-ID: <1274083177.17643.8.camel@chilepepper> Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org List-ID: On Sat, 2010-05-15 at 23:16 +0200, ext Julia Lawall wrote: > From: Julia Lawall > > Use kmemdup when some other buffer is immediately copied into the > allocated region. > > A simplified version of the semantic patch that makes this change is as > follows: (http://coccinelle.lip6.fr/) > > // > @@ > expression from,to,size,flag; > statement S; > @@ > > - to = \(kmalloc\|kzalloc\)(size,flag); > + to = kmemdup(from,size,flag); > if (to==NULL || ...) S > - memcpy(to, from, size); > // > > Signed-off-by: Julia Lawall Thanks. Acked-by: Luciano Coelho -- Cheers, Luca.