From: Ajit Khaparde Date: Thu, 8 Jul 2021 22:09:18 +0000 (-0700) Subject: net/bnxt: fix build X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=72d7b5959fa5ebceb6175757ea6c1a46a4ffd4bc;p=dpdk.git net/bnxt: fix build Fix build failures seen on Fedora Core 34 (GCC 11) because of uninitialized variables. In function ‘ulp_mapper_index_tbl_process’: drivers/net/bnxt/tf_ulp/ulp_mapper.c:2252:43: error: ‘*(unsigned int *)((char *)&glb_res + offsetof(struct bnxt_ulp_glb_resource_info, resource_func))’ may be used uninitialized in this function 2252 | struct bnxt_ulp_glb_resource_info glb_res; | ^~~~~~~ drivers/net/bnxt/tf_ulp/ulp_mapper.c:2252:43: error: ‘glb_res.resource_type’ may be used uninitialized in this function In function ‘dpool_defrag’: drivers/net/bnxt/tf_core/dpool.c:95:18: error: ‘index’ may be used uninitialized in this function 95 | uint32_t index; | ^~~~~ Fixes: 05b405d58148 ("net/bnxt: add dpool allocator for EM allocation") Signed-off-by: Kishore Padmanabha Signed-off-by: Ajit Khaparde --- diff --git a/drivers/net/bnxt/tf_core/dpool.c b/drivers/net/bnxt/tf_core/dpool.c index 0dae42b1bb..145efa486f 100644 --- a/drivers/net/bnxt/tf_core/dpool.c +++ b/drivers/net/bnxt/tf_core/dpool.c @@ -125,6 +125,7 @@ int dpool_defrag(struct dpool *dpool, largest_free_size = 0; largest_free_index = 0; count = 0; + index = 0; for (i = 0; i < dpool->size; i++) { if (DP_IS_FREE(dpool->entry[i].flags)) { diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index acd9f996e8..871dbad0fe 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -2249,7 +2249,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, struct tf_free_tbl_entry_parms free_parms = { 0 }; uint32_t tbl_scope_id; struct tf *tfp; - struct bnxt_ulp_glb_resource_info glb_res; + struct bnxt_ulp_glb_resource_info glb_res = { 0 }; uint16_t bit_size; bool alloc = false; bool write = false;