Commit b7ffc98a authored by Shen Lichuan's avatar Shen Lichuan Committed by Dmitry Torokhov

Input: wistron_btns - use kmemdup_array instead of kmemdup for multiple allocation

Let the kmemdup_array() take care about multiplication
and possible overflows.

Using kmemdup_array() is more appropriate and makes the code
easier to audit.
Signed-off-by: default avatarShen Lichuan <shenlichuan@vivo.com>
Link: https://lore.kernel.org/r/20240826045253.3503-1-shenlichuan@vivo.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 6994d8b8
......@@ -990,8 +990,8 @@ static int __init copy_keymap(void)
for (key = keymap; key->type != KE_END; key++)
length++;
new_keymap = kmemdup(keymap, length * sizeof(struct key_entry),
GFP_KERNEL);
new_keymap = kmemdup_array(keymap, length, sizeof(struct key_entry),
GFP_KERNEL);
if (!new_keymap)
return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment