]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: Use kmemdup for drivers
authorJulia Lawall <julia@diku.dk>
Sat, 15 May 2010 21:19:15 +0000 (23:19 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 21 Jul 2010 17:39:06 +0000 (10:39 -0700)
commit1e2e5a8a6d48f19d1c38dc13b6b0b490bada9dee
tree68a26906d9e25bbd5963c5feae54fbe29dc81fee
parentc8feed07efb5f2e5eb5017b9ffd338373602675e
Bluetooth: Use kmemdup for drivers

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>
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/bcm203x.c