Skip to contentSkip to conversation

i2o: use kstrdup()

PATCH In review Thomas Meyer 2 participants 2 messages Aug 6, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2o: use kstrdup()

From: Thomas Meyer <[email protected]>

Use kstrdup rather than duplicating its implementation

The semantic patch that makes this output is available in scripts/coccinelle/api/kstrdup.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

---

drivers/message/i2o/memory.c 2011-08-01 21:02:30.929472234 +0200 renamed from drivers/message/i2o/memory.c 2010-03-27 23:39:49.118521162 +0100 +1 -2
diff -u -p a/drivers/message/i2o/memory.c b/drivers/message/i2o/memory.c
@@ -270,10 +270,9 @@ EXPORT_SYMBOL_GPL(i2o_dma_realloc);
 int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
 				 size_t size, int min_nr)
 {
-	pool->name = kmalloc(strlen(name) + 1, GFP_KERNEL);
+	pool->name = kstrdup(name, GFP_KERNEL);
 	if (!pool->name)
 		goto exit;
-	strcpy(pool->name, name);
 
 	pool->slab =
 	    kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL);
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · On Sat, 06 Aug 2011 11:30:50 +0200 Thomas Meyer <[email protected]> wrote:

From: Thomas Meyer <[email protected]>

Use kstrdup rather than duplicating its implementation

The semantic patch that makes this output is available in scripts/coccinelle/api/kstrdup.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/