i40e: fix sign extension issue
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Sat, 28 Sep 2013 07:13:49 +0000 (07:13 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 22 Oct 2013 13:09:16 +0000 (06:09 -0700)
This is a fix for an issue reported by coverity, reported
by Hannes Frederic Sowa.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Hannes Frederic Sowa <hannes@stressinduktion.org>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_txrx.c

index fbc40cd..8fc313c 100644 (file)
@@ -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);