From: Abdul Hussain S Date: Wed, 18 Mar 2015 09:16:00 +0000 (+0530) Subject: staging: i2o: Use kstrdup rather than duplicating its implementation X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d38f486142b6edf3dfd3407d8f0e8a55309a9e41;p=linux-beck.git staging: i2o: Use kstrdup rather than duplicating its implementation The semantic patch that makes this change is available in scripts/coccinelle/api/kstrdup.cocci Signed-off-by: Abdul Hussain S Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/i2o/memory.c b/drivers/staging/i2o/memory.c index 8f9509d275a4..78b702c18537 100644 --- a/drivers/staging/i2o/memory.c +++ b/drivers/staging/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);