diff options
author | Alexandru Gheorghiu <gheorghiuandru@gmail.com> | 2013-05-16 15:04:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-16 16:49:25 -0400 |
commit | 1b6b698f53b3a5382a907308048d77c8bacca4ab (patch) | |
tree | 94a14065c80ca121f4f4f07a805ed1a828ef0a3c /drivers/char/ipmi/ipmi_msghandler.c | |
parent | f722406faae2d073cc1d01063d1123c35425939e (diff) |
drivers: char: ipmi: Replaced kmalloc and strcpy with kstrdup
Replaced calls to kmalloc followed by strcpy with a sincle call to
kstrdup. Patch found using coccinelle.
Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/ipmi/ipmi_msghandler.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 4d439d2fcfd6..4445fa164a2d 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -2037,12 +2037,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, | |||
2037 | entry = kmalloc(sizeof(*entry), GFP_KERNEL); | 2037 | entry = kmalloc(sizeof(*entry), GFP_KERNEL); |
2038 | if (!entry) | 2038 | if (!entry) |
2039 | return -ENOMEM; | 2039 | return -ENOMEM; |
2040 | entry->name = kmalloc(strlen(name)+1, GFP_KERNEL); | 2040 | entry->name = kstrdup(name, GFP_KERNEL); |
2041 | if (!entry->name) { | 2041 | if (!entry->name) { |
2042 | kfree(entry); | 2042 | kfree(entry); |
2043 | return -ENOMEM; | 2043 | return -ENOMEM; |
2044 | } | 2044 | } |
2045 | strcpy(entry->name, name); | ||
2046 | 2045 | ||
2047 | file = proc_create_data(name, 0, smi->proc_dir, proc_ops, data); | 2046 | file = proc_create_data(name, 0, smi->proc_dir, proc_ops, data); |
2048 | if (!file) { | 2047 | if (!file) { |