]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
USB: gadget: Use kmemdup
authorJulia Lawall <julia@diku.dk>
Sat, 15 May 2010 21:15:44 +0000 (23:15 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 20 May 2010 20:21:49 +0000 (13:21 -0700)
commit4b8e12336fede9e30b6140e840431161d46cf677
tree54242b26f4c80b497904c925842cb56a6c69c0a2
parenteefd9029fde4d90d59804eeb54880ab8db5c1866
USB: gadget: 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>
drivers/usb/gadget/atmel_usba_udc.c