iwlwifi: mvm: rfi: use kmemdup() to replace kzalloc + memcpy
[ Upstream commit 08186e2501eec554cde8bae53b1d1de4d54abdf4 ] Fix memdup.cocci warning: ./drivers/net/wireless/intel/iwlwifi/mvm/rfi.c:110:8-15: WARNING opportunity for kmemdup Signed-off-by: Bixuan Cui <cuibixuan@linux.alibaba.com> Link: https://lore.kernel.org/r/1635317920-84725-1-git-send-email-cuibixuan@linux.alibaba.com Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Stable-dep-of: 06a093807eb7 ("wifi: iwlwifi: mvm: rfi: fix potential response leaks") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d60ff8e04b
commit
254f1c2521
@ -107,12 +107,10 @@ struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm)
|
||||
if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) != resp_size))
|
||||
return ERR_PTR(-EIO);
|
||||
|
||||
resp = kzalloc(resp_size, GFP_KERNEL);
|
||||
resp = kmemdup(cmd.resp_pkt->data, resp_size, GFP_KERNEL);
|
||||
if (!resp)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
memcpy(resp, cmd.resp_pkt->data, resp_size);
|
||||
|
||||
iwl_free_resp(&cmd);
|
||||
return resp;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user