Staging: Use kmemdup
commit94002c07ff0e207a883519ccc35c0b5390b29331
authorJulia Lawall <julia@diku.dk>
Sat, 15 May 2010 21:21:43 +0000 (15 23:21 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 17 May 2010 23:31:15 +0000 (17 16:31 -0700)
treeb730a75ef2ad76d1e3a322e5982b30ca46b6c487
parent96fe9ee2c2dfe3268961f3873ea6098b9b9f27c2
Staging: Use kmemdup

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/)

// <smpl>
@@
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);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 files changed:
drivers/staging/comedi/drivers/usbdux.c
drivers/staging/comedi/drivers/usbduxfast.c
drivers/staging/hv/vmbus.c
drivers/staging/line6/dumprequest.c
drivers/staging/line6/pod.c
drivers/staging/line6/variax.c
drivers/staging/pohmelfs/config.c
drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
drivers/staging/usbip/stub_rx.c