Commit 1aa5eb67 authored by Thomas Meyer's avatar Thomas Meyer Committed by Greg Kroah-Hartman

Staging: speakup: Use kmemdup rather than duplicating its implementation

Use kmemdup rather than duplicating its implementation

The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.
Signed-off-by: default avatarThomas Meyer <thomas@m3y3r.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cd420765
...@@ -265,12 +265,11 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr, ...@@ -265,12 +265,11 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr,
unsigned long flags; unsigned long flags;
spk_lock(flags); spk_lock(flags);
in_buff = kmalloc(count + 1, GFP_ATOMIC); in_buff = kmemdup(buf, count + 1, GFP_ATOMIC);
if (!in_buff) { if (!in_buff) {
spk_unlock(flags); spk_unlock(flags);
return -ENOMEM; return -ENOMEM;
} }
memcpy(in_buff, buf, count + 1);
if (strchr("dDrR", *in_buff)) { if (strchr("dDrR", *in_buff)) {
set_key_info(key_defaults, key_buf); set_key_info(key_defaults, key_buf);
pr_info("keymap set to default values\n"); pr_info("keymap set to default values\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment