mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
staging: wilc1000: replace kmalloc/memcpy with kmemdup
This patch replaces kmalloc followed by memcpy with kmemdup. It is also added error checking to return -ENOMEM when kmemdup is failed. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ff3bce2f6c
commit
58eabd68a4
|
|
@ -3165,8 +3165,10 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
|
|||
msg.body.key_info.type = WEP;
|
||||
msg.body.key_info.action = ADDKEY_AP;
|
||||
msg.drv = hif_drv;
|
||||
msg.body.key_info.attr.wep.key = kmalloc(len, GFP_KERNEL);
|
||||
memcpy(msg.body.key_info.attr.wep.key, key, len);
|
||||
msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
|
||||
if (!msg.body.key_info.attr.wep.key)
|
||||
return -ENOMEM;
|
||||
|
||||
msg.body.key_info.attr.wep.key_len = len;
|
||||
msg.body.key_info.attr.wep.index = index;
|
||||
msg.body.key_info.attr.wep.mode = mode;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user