From: Jesse Brandeburg Date: Sat, 28 Sep 2013 07:13:49 +0000 (+0000) Subject: i40e: fix sign extension issue X-Git-Tag: firefly_0821_release~176^2~4992^2~141^2~6 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0976a01610e76064bff95704573b3a9c747bca4f;p=firefly-linux-kernel-4.4.55.git i40e: fix sign extension issue This is a fix for an issue reported by coverity, reported by Hannes Frederic Sowa. Signed-off-by: Jesse Brandeburg CC: Hannes Frederic Sowa Tested-by: Kavindya Deegala Signed-off-by: Jeff Kirsher --- diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index fbc40cd29d23..8fc313c2a2e7 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -99,9 +99,9 @@ int i40e_program_fdir_filter(struct i40e_fdir_data *fdir_data, << I40E_TXD_FLTR_QW0_DEST_VSI_SHIFT); else fdir_desc->qindex_flex_ptype_vsi |= - cpu_to_le32((fdir_data->dest_vsi - << I40E_TXD_FLTR_QW0_DEST_VSI_SHIFT) - & I40E_TXD_FLTR_QW0_DEST_VSI_MASK); + cpu_to_le32((((u32)fdir_data->dest_vsi) << + I40E_TXD_FLTR_QW0_DEST_VSI_SHIFT) & + I40E_TXD_FLTR_QW0_DEST_VSI_MASK); fdir_desc->dtype_cmd_cntindex = cpu_to_le32(I40E_TX_DESC_DTYPE_FILTER_PROG); @@ -127,9 +127,9 @@ int i40e_program_fdir_filter(struct i40e_fdir_data *fdir_data, fdir_desc->dtype_cmd_cntindex |= cpu_to_le32(I40E_TXD_FLTR_QW1_CNT_ENA_MASK); fdir_desc->dtype_cmd_cntindex |= - cpu_to_le32((fdir_data->cnt_index - << I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) - & I40E_TXD_FLTR_QW1_CNTINDEX_MASK); + cpu_to_le32((((u32)fdir_data->cnt_index) << + I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) & + I40E_TXD_FLTR_QW1_CNTINDEX_MASK); } fdir_desc->fd_id = cpu_to_le32(fdir_data->fd_id);