* [PATCH] Staging: speakup: Use kmemdup rather than duplicating its implementation
@ 2011-11-12 12:11 Thomas Meyer
0 siblings, 0 replies; only message in thread
From: Thomas Meyer @ 2011-11-12 12:11 UTC (permalink / raw)
To: Greg Kroah-Hartman, speakup, devel, linux-kernel
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>
---
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");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-11-12 16:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-12 12:11 [PATCH] Staging: speakup: Use kmemdup rather than duplicating its implementation Thomas Meyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®