mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] aoe: Use kmemdup rather than duplicating its implementation
@ 2011-11-17 22:43 Thomas Meyer
  0 siblings, 0 replies; only message in thread
From: Thomas Meyer @ 2011-11-17 22:43 UTC (permalink / raw)
  To: linux-kernel

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

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
--- a/drivers/block/aoe/aoechr.c 2011-11-07 19:39:05.287793252 +0100
+++ b/drivers/block/aoe/aoechr.c 2011-11-08 10:37:35.225430670 +0100
@@ -134,13 +134,12 @@ bail:		spin_unlock_irqrestore(&emsgs_loc
 		return;
 	}
 
-	mp = kmalloc(n, GFP_ATOMIC);
+	mp = kmemdup(msg, n, GFP_ATOMIC);
 	if (mp == NULL) {
 		printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n);
 		goto bail;
 	}
 
-	memcpy(mp, msg, n);
 	em->msg = mp;
 	em->flags |= EMFL_VALID;
 	em->len = n;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-22 11:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-17 22:43 [PATCH] aoe: Use kmemdup rather than duplicating its implementation Thomas Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®