[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1312622416.5589.61.camel@localhost.localdomain>
Date: Sat, 06 Aug 2011 11:20:13 +0200
From: Thomas Meyer <thomas@...3r.de>
To: openipmi-developer@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: [PATCH] ipmi: use kstrdup()
From: Thomas Meyer <thomas@...3r.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@...3r.de>
---
diff -u -p a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
--- a/drivers/char/ipmi/ipmi_msghandler.c 2011-05-27 19:17:04.559520123 +0200
+++ b/drivers/char/ipmi/ipmi_msghandler.c 2011-08-01 21:10:43.970134537 +0200
@@ -2030,12 +2030,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t s
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
if (!entry)
return -ENOMEM;
- entry->name = kmalloc(strlen(name)+1, GFP_KERNEL);
+ entry->name = kstrdup(name, GFP_KERNEL);
if (!entry->name) {
kfree(entry);
return -ENOMEM;
}
- strcpy(entry->name, name);
file = proc_create_data(name, 0, smi->proc_dir, proc_ops, data);
if (!file) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists