[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1321099878.1668.18.camel@localhost.localdomain>
Date: Sat, 12 Nov 2011 13:11:18 +0100
From: Thomas Meyer <thomas@...3r.de>
To: Greg Kroah-Hartman <gregkh@...e.de>, speakup@...ille.uwo.ca,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] 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@...3r.de>
---
diff -u -p a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
--- a/drivers/staging/speakup/kobjects.c 2011-11-07 19:38:12.073651604 +0100
+++ b/drivers/staging/speakup/kobjects.c 2011-11-08 10:52:31.467444789 +0100
@@ -265,12 +265,11 @@ static ssize_t keymap_store(struct kobje
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");
--
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