diff options
author | Bixuan Cui <cuibixuan@linux.alibaba.com> | 2021-10-27 14:58:40 +0800 |
---|---|---|
committer | Luca Coelho <luciano.coelho@intel.com> | 2022-02-18 10:40:56 +0200 |
commit | 08186e2501eec554cde8bae53b1d1de4d54abdf4 (patch) | |
tree | a814b6377c9960da30893e05202738174335e39f /drivers/net/wireless/intel/iwlwifi/mvm/rfi.c | |
parent | 195a367ee4bd8246383b6e726ae26fac6a160b9d (diff) |
iwlwifi: mvm: rfi: use kmemdup() to replace kzalloc + memcpy
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>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mvm/rfi.c')
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/rfi.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c index 7acb2be08e1d..bb77bc9aa821 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c @@ -125,12 +125,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; } |