summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2011-11-12 13:11:18 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-26 18:12:56 -0800
commit1aa5eb67d70fa1f801b8b988d7e48e264c283c5e (patch)
tree26fdd13930ddb3efc5516b5410ce1cb34bc75f4d
parentcd420765eb48f052c627a934017f8e95fb011aef (diff)
downloadblackbird-op-linux-1aa5eb67d70fa1f801b8b988d7e48e264c283c5e.tar.gz
blackbird-op-linux-1aa5eb67d70fa1f801b8b988d7e48e264c283c5e.zip
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: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/speakup/kobjects.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index 07a7f5432597..2093896c546b 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -265,12 +265,11 @@ static ssize_t keymap_store(struct kobject *kobj, struct kobj_attribute *attr,
unsigned long flags;
spk_lock(flags);
- in_buff = kmalloc(count + 1, GFP_ATOMIC);
+ in_buff = kmemdup(buf, count + 1, GFP_ATOMIC);
if (!in_buff) {
spk_unlock(flags);
return -ENOMEM;
}
- memcpy(in_buff, buf, count + 1);
if (strchr("dDrR", *in_buff)) {
set_key_info(key_defaults, key_buf);
pr_info("keymap set to default values\n");
OpenPOWER on IntegriCloud