iwlwifi: memcpy from dev_cmd and not dev_cmd->hdr
authorLiad Kaufman <liad.kaufman@intel.com>
Mon, 22 Oct 2018 07:12:28 +0000 (10:12 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 25 Jan 2019 18:57:21 +0000 (20:57 +0200)
Klocwork complains about copying from dev_cmd->hdr if
copying more than 4 bytes since it means part of the
copy is from the next field. This isn't a real bug,
but for not failing Klocwork next time - fix this.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
drivers/net/wireless/intel/iwlwifi/pcie/tx.c

index af2791502b7db5a1838101c9f2e8c30e250137d2..d2bd7f528a205014d5d53f4c5ef9682747dc9ebc 100644 (file)
@@ -412,7 +412,7 @@ iwl_tfh_tfd *iwl_pcie_gen2_build_tx_amsdu(struct iwl_trans *trans,
                goto out_err;
 
        /* building the A-MSDU might have changed this data, memcpy it now */
-       memcpy(&txq->first_tb_bufs[idx], &dev_cmd->hdr, IWL_FIRST_TB_SIZE);
+       memcpy(&txq->first_tb_bufs[idx], dev_cmd, IWL_FIRST_TB_SIZE);
        return tfd;
 
 out_err:
@@ -473,7 +473,7 @@ iwl_tfh_tfd *iwl_pcie_gen2_build_tx(struct iwl_trans *trans,
        tb_phys = iwl_pcie_get_first_tb_dma(txq, idx);
 
        /* The first TB points to bi-directional DMA data */
-       memcpy(&txq->first_tb_bufs[idx], &dev_cmd->hdr, IWL_FIRST_TB_SIZE);
+       memcpy(&txq->first_tb_bufs[idx], dev_cmd, IWL_FIRST_TB_SIZE);
 
        iwl_pcie_gen2_set_tb(trans, tfd, tb_phys, IWL_FIRST_TB_SIZE);
 
index ee990a7a5411dee4cd4e2f204362041b7528a211..7073116c73b7e074b975fc67afe8ef86814ef924 100644 (file)
@@ -2438,8 +2438,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
        }
 
        /* building the A-MSDU might have changed this data, so memcpy it now */
-       memcpy(&txq->first_tb_bufs[txq->write_ptr], &dev_cmd->hdr,
-              IWL_FIRST_TB_SIZE);
+       memcpy(&txq->first_tb_bufs[txq->write_ptr], dev_cmd, IWL_FIRST_TB_SIZE);
 
        tfd = iwl_pcie_get_tfd(trans, txq, txq->write_ptr);
        /* Set up entry for this TFD in Tx byte-count array */