]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: i2o: Use kstrdup rather than duplicating its implementation
authorAbdul Hussain S <hussain.abdul@outlook.com>
Wed, 18 Mar 2015 09:16:00 +0000 (14:46 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Mar 2015 12:44:39 +0000 (13:44 +0100)
The semantic patch that makes this change is available
in scripts/coccinelle/api/kstrdup.cocci

Signed-off-by: Abdul Hussain S <hussain.abdul@outlook.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/i2o/memory.c

index 8f9509d275a46f4b66d399d932d5a472a9639741..78b702c185371b464c4a884a9eeb1131b3ee61bc 100644 (file)
@@ -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);