Skip to content

Commit

Permalink
iwlwifi: mvm: rfi: use kmemdup() to replace kzalloc + memcpy
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bixuan Cui authored and Luca Coelho committed Feb 18, 2022
1 parent 195a367 commit 08186e2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 08186e2

Please sign in to comment.