lkml.org 
[lkml]   [2011]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH] i2o: use kstrdup()
    From
    Date
    From: Thomas Meyer <thomas@m3y3r.de>

    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/

    Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
    ---

    diff -u -p a/drivers/message/i2o/memory.c b/drivers/message/i2o/memory.c
    --- a/drivers/message/i2o/memory.c 2010-03-27 23:39:49.118521162 +0100
    +++ b/drivers/message/i2o/memory.c 2011-08-01 21:02:30.929472234 +0200
    @@ -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);



    \
     
     \ /
      Last update: 2011-08-06 11:33    [W:0.018 / U:0.192 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site