lkml.org 
[lkml]   [2013]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] drivers: message: i2o: Use kstrdup function
Date
Use kstrdup instead kmalloc and strcpy.
Patch found using coccinelle

Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
---
drivers/message/i2o/memory.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/message/i2o/memory.c b/drivers/message/i2o/memory.c
index 292b41e..1741a59 100644
--- 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);
--
1.7.9.5


\
 
 \ /
  Last update: 2013-03-19 15:01    [W:0.026 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site