Skip to content

Commit

Permalink
Input: wistron_btns - switch to using kmemdup()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julia Lawall authored and Dmitry Torokhov committed May 19, 2010
1 parent 641d446 commit f8300ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/input/misc/wistron_btns.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f8300ab

Please sign in to comment.