[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1321569820.1624.279.camel@localhost.localdomain>
Date: Thu, 17 Nov 2011 23:43:40 +0100
From: Thomas Meyer <thomas@...3r.de>
To: linux-kernel@...r.kernel.org
Subject: [PATCH] aoe: 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@...3r.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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists