Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1432066

Re: [PATCH] tipc: Use kmemdup instead of kmalloc and memcpy

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH] tipc: Use kmemdup instead of kmalloc and memcpy
Date 2016-06-27 16:10 +0200
Message-ID <rOFoD-1gZ-45@gated-at.bofh.it> (permalink)
References <rN4Kt-4Wx-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Amitoj Kaur Chawla <amitoj1606@gmail.com>
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 <amitoj1606@gmail.com>

Applied.

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] tipc: Use kmemdup instead of kmalloc and memcpy David Miller <davem@davemloft.net> - 2016-06-27 16:10 +0200

csiph-web