From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751885AbcF0OAN (ORCPT ); Mon, 27 Jun 2016 10:00:13 -0400 Received: from shards.monkeyblade.net ([149.20.54.216]:44448 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750870AbcF0OAL (ORCPT ); Mon, 27 Jun 2016 10:00:11 -0400 Date: Mon, 27 Jun 2016 09:59:36 -0400 (EDT) Message-Id: <20160627.095936.2017216616383106273.davem@davemloft.net> To: amitoj1606@gmail.com Cc: jon.maloy@ericsson.com, ying.xue@windriver.com, netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org, julia.lawall@lip6.fr Subject: Re: [PATCH] tipc: Use kmemdup instead of kmalloc and memcpy From: David Miller In-Reply-To: <20160623044937.GA14109@amitoj-Inspiron-3542> References: <20160623044937.GA14109@amitoj-Inspiron-3542> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 27 Jun 2016 07:00:11 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amitoj Kaur Chawla Date: Thu, 23 Jun 2016 10:19:37 +0530 > Replace calls to kmalloc followed by a memcpy with a direct call to > kmemdup. > > The Coccinelle semantic patch used to make this change is as follows: > @@ > 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: Amitoj Kaur Chawla Applied.