Input: wistron_btns - use kmemdup_array instead of kmemdup for multiple allocation
Subsystems (3)
PATCH 1/1 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 Shen Lichuan <[email protected]>
--- drivers/input/misc/wistron_btns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/misc/wistron_btns.c +2 -2
@@ -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 ;
Signature · 1 line
2.17.1
Quoted 7 lines · Shen Lichuan
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 Shen Lichuan <[email protected]>
Applied, thank you.
Signature · 1 line
Dmitry