Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

irttp: Use kmemdup rather than duplicating its implementation

The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Thomas Meyer and committed by
David S. Miller
8524b001 efd0bf97

+1 -3
+1 -3
net/irda/irttp.c
··· 1461 1461 } 1462 1462 1463 1463 /* Allocate a new instance */ 1464 - new = kmalloc(sizeof(struct tsap_cb), GFP_ATOMIC); 1464 + new = kmemdup(orig, sizeof(struct tsap_cb), GFP_ATOMIC); 1465 1465 if (!new) { 1466 1466 IRDA_DEBUG(0, "%s(), unable to kmalloc\n", __func__); 1467 1467 spin_unlock_irqrestore(&irttp->tsaps->hb_spinlock, flags); 1468 1468 return NULL; 1469 1469 } 1470 - /* Dup */ 1471 - memcpy(new, orig, sizeof(struct tsap_cb)); 1472 1470 spin_lock_init(&new->lock); 1473 1471 1474 1472 /* We don't need the old instance any more */