mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-26 16:39:32 +07:00
staging: wilc1000: use kmemdup instead of kmalloc/memcpy
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
d317818bf4
commit
1a271d9960
@ -3704,12 +3704,16 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
|
||||
msg.body.scan_info.arg = user_arg;
|
||||
|
||||
msg.body.scan_info.ch_list_len = ch_list_len;
|
||||
msg.body.scan_info.ch_freq_list = kmalloc(ch_list_len, GFP_KERNEL);
|
||||
memcpy(msg.body.scan_info.ch_freq_list, ch_freq_list, ch_list_len);
|
||||
msg.body.scan_info.ch_freq_list = kmemdup(ch_freq_list,
|
||||
ch_list_len,
|
||||
GFP_KERNEL);
|
||||
if (!msg.body.scan_info.ch_freq_list)
|
||||
return -ENOMEM;
|
||||
|
||||
msg.body.scan_info.ies_len = ies_len;
|
||||
msg.body.scan_info.ies = kmalloc(ies_len, GFP_KERNEL);
|
||||
memcpy(msg.body.scan_info.ies, ies, ies_len);
|
||||
msg.body.scan_info.ies = kmemdup(ies, ies_len, GFP_KERNEL);
|
||||
if (!msg.body.scan_info.ies)
|
||||
return -ENOMEM;
|
||||
|
||||
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
|
||||
if (result) {
|
||||
|
Loading…
Reference in New Issue
Block a user