Via code inspection, I found that some partially initialized
stack variables were being passed along to called functions,
which could eventually result in those uninitialized members
being used. To fix this, make sure the local variables are
zeroed out before partially initializing them. This should
prevent any unintended consequences from using stack memory that
might have junk in it.
In addition to the memsets, this patch also initializes one
member in one function, that needed to be initialized to non-zero.
Fixes:
fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe")
Cc: stable@dpdk.org
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
if (status)
return status;
if (status)
return status;
+ ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM);
tmp_fltr.fltr_rule_id = cur_fltr->fltr_rule_id;
tmp_fltr.fltr_act = ICE_FWD_TO_VSI_LIST;
tmp_fltr.fwd_id.vsi_list_id = vsi_list_id;
tmp_fltr.fltr_rule_id = cur_fltr->fltr_rule_id;
tmp_fltr.fltr_act = ICE_FWD_TO_VSI_LIST;
tmp_fltr.fwd_id.vsi_list_id = vsi_list_id;
+ tmp_fltr.lkup_type = ICE_SW_LKUP_LAST;
+
/* Update the previous switch rule of "forward to VSI" to
* "fwd to VSI list"
*/
/* Update the previous switch rule of "forward to VSI" to
* "fwd to VSI list"
*/
if (rinfo->sw_act.fltr_act == ICE_FWD_TO_VSI) {
struct ice_fltr_info tmp_fltr;
if (rinfo->sw_act.fltr_act == ICE_FWD_TO_VSI) {
struct ice_fltr_info tmp_fltr;
+ ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM);
tmp_fltr.fltr_rule_id =
LE16_TO_CPU(s_rule->pdata.lkup_tx_rx.index);
tmp_fltr.fltr_act = ICE_FWD_TO_VSI;
tmp_fltr.fltr_rule_id =
LE16_TO_CPU(s_rule->pdata.lkup_tx_rx.index);
tmp_fltr.fltr_act = ICE_FWD_TO_VSI;
lkup_type);
if (status)
return status;
lkup_type);
if (status)
return status;
+
+ ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM);
tmp_fltr.fltr_rule_id = fm_list->rule_info.fltr_rule_id;
fm_list->rule_info.sw_act.fltr_act = ICE_FWD_TO_VSI;
tmp_fltr.fltr_act = ICE_FWD_TO_VSI;
tmp_fltr.fltr_rule_id = fm_list->rule_info.fltr_rule_id;
fm_list->rule_info.sw_act.fltr_act = ICE_FWD_TO_VSI;
tmp_fltr.fltr_act = ICE_FWD_TO_VSI;