]> git.baikalelectronics.ru Git - kernel.git/commit
Staging: wilc1000: cfg80211: Use kmemdup instead of kmalloc and memcpy
authorShreeya Patel <shreeya.patel23498@gmail.com>
Fri, 13 Mar 2020 11:24:51 +0000 (16:54 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Mar 2020 13:00:45 +0000 (14:00 +0100)
commitb98945199527f128e6d54d1c042e2869447624bd
treeb9821bddba0babb07903f630454282a087a286f4
parented9effd472eb3be089daf729731e2cd408c11e01
Staging: wilc1000: cfg80211: Use kmemdup instead of kmalloc and memcpy

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: Shreeya Patel <shreeya.patel23498@gmail.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Link: https://lore.kernel.org/r/20200313112451.25610-1-shreeya.patel23498@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/cfg80211.c