From: Julia Lawall Date: Wed, 19 May 2010 17:11:14 +0000 (-0700) Subject: Input: wistron_btns - switch to using kmemdup() X-Git-Tag: MMI-PSA29.97-13-9~23444^2~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f8300ab8c3e0bea42c82bbdcdff7b791b795d58f;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git Input: wistron_btns - switch to using kmemdup() Use kmemdup when some other buffer is immediately copied into the allocated region. Signed-off-by: Julia Lawall Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 04d5a4a3181f..4dac8b79fcd4 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -983,11 +983,11 @@ static int __init copy_keymap(void) for (key = keymap; key->type != KE_END; key++) length++; - new_keymap = kmalloc(length * sizeof(struct key_entry), GFP_KERNEL); + new_keymap = kmemdup(keymap, length * sizeof(struct key_entry), + GFP_KERNEL); if (!new_keymap) return -ENOMEM; - memcpy(new_keymap, keymap, length * sizeof(struct key_entry)); keymap = new_keymap; return 0;