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 <julia@diku.dk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
Julia Lawall 2010-05-19 10:11:14 -07:00 committed by Dmitry Torokhov
parent 641d446f89
commit f8300ab8c3

View file

@ -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;