* [PATCH] i2o: use kstrdup()
@ 2011-08-06 9:30 Thomas Meyer
2011-08-06 10:14 ` Alan Cox
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Meyer @ 2011-08-06 9:30 UTC (permalink / raw)
To: Linux Kernel Mailing List
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] i2o: use kstrdup()
2011-08-06 9:30 [PATCH] i2o: use kstrdup() Thomas Meyer
@ 2011-08-06 10:14 ` Alan Cox
0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2011-08-06 10:14 UTC (permalink / raw)
To: Thomas Meyer; +Cc: Linux Kernel Mailing List
On Sat, 06 Aug 2011 11:30:50 +0200
Thomas Meyer <thomas@m3y3r.de> wrote:
> 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>
Acked-by: Alan Cox <alan@linux.intel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-06 10:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-06 9:30 [PATCH] i2o: use kstrdup() Thomas Meyer
2011-08-06 10:14 ` Alan Cox
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.