Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b6b698f authored by Alexandru Gheorghiu's avatar Alexandru Gheorghiu Committed by Linus Torvalds
Browse files

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: default avatarAlexandru Gheorghiu <gheorghiuandru@gmail.com>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f722406f
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -2037,12 +2037,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
	if (!entry)
	if (!entry)
		return -ENOMEM;
		return -ENOMEM;
	entry->name = kmalloc(strlen(name)+1, GFP_KERNEL);
	entry->name = kstrdup(name, GFP_KERNEL);
	if (!entry->name) {
	if (!entry->name) {
		kfree(entry);
		kfree(entry);
		return -ENOMEM;
		return -ENOMEM;
	}
	}
	strcpy(entry->name, name);


	file = proc_create_data(name, 0, smi->proc_dir, proc_ops, data);
	file = proc_create_data(name, 0, smi->proc_dir, proc_ops, data);
	if (!file) {
	if (!file) {