From: Qi Zhang Date: Tue, 8 Oct 2019 01:50:13 +0000 (+0800) Subject: net/ice/base: initialize structures to zero X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=40dceddab7c3ac11eb166aa788b66172a4615f6f;p=dpdk.git net/ice/base: initialize structures to zero Some functions create ice_pkg_enum structure, but it seems it's possible some of the members are used un-initialized. So we'll initialize all instantiations of this structure within ice_flex_pipe.c The patch also fix header comment mismatch issue for ice_init_prof_result_bm Signed-off-by: Jeb Cramer Signed-off-by: Jesse Brandeburg Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index 8f8cab86e3..bf14149b89 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -470,6 +470,7 @@ static void ice_init_pkg_hints(struct ice_hw *hw, struct ice_seg *ice_seg) int i; ice_memset(&hw->tnl, 0, sizeof(hw->tnl), ICE_NONDMA_MEM); + ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM); if (!ice_seg) return; @@ -1517,6 +1518,8 @@ ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type type, struct ice_seg *ice_seg; struct ice_fv *fv; + ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM); + if (type == ICE_PROF_ALL) { u16 i; @@ -1573,6 +1576,8 @@ ice_get_sw_fv_list(struct ice_hw *hw, u16 *prot_ids, u8 ids_cnt, struct ice_fv *fv; u32 offset; + ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM); + if (!ids_cnt || !hw->seg) return ICE_ERR_PARAM; @@ -1633,16 +1638,17 @@ err: } /** - * ice_init_profile_to_result_bm - Initialize the profile result index bitmap + * ice_init_prof_result_bm - Initialize the profile result index bitmap * @hw: pointer to hardware structure */ -void -ice_init_prof_result_bm(struct ice_hw *hw) +void ice_init_prof_result_bm(struct ice_hw *hw) { struct ice_pkg_enum state; struct ice_seg *ice_seg; struct ice_fv *fv; + ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM); + if (!hw->seg) return;