net/bnxt: fix build failure
PATCH 1/1 net/bnxt: fix build failure
Fix build failures because of uninitialized variable usage.
--- drivers/net/bnxt/tf_core/dpool.c | 1 + drivers/net/bnxt/tf_ulp/ulp_mapper.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_core/dpool.c +1 -0
@@ -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)) {
drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -1
@@ -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;
Signature · 1 line
2.21.1 (Apple Git-122.3)
09/07/2021 00:49, Ajit Khaparde:
Quoted 1 line
Fix build failures because of uninitialized variable usage.
You should add the error log here.
You don't mention the condition of failure.
Nobody reproduced a failure so far.
Quoted 4 lines
Fixes 05b405d58148 ("net/bnxt: add dpool allocator for EM allocation")Signed-off-by Kishore Padmanabha <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>
Quoted 7 lines · Thomas Monjalon
09/07/2021 00:49, Ajit Khaparde:
Quoted 1 line
Fix build failures because of uninitialized variable usage.
You should add the error log here.
You don't mention the condition of failure.
Nobody reproduced a failure so far.
Sure. I did not notice it on my Fedora34 either. The build error was reported in the dpdk-test-report [1]. Let me resend a v2 with the information.
[1] http://mails.dpdk.org/archives/test-report/2021-July/203186.html
Quoted 8 lines
Quoted 4 lines
Fixes 05b405d58148 ("net/bnxt: add dpool allocator for EM allocation")Signed-off-by Kishore Padmanabha <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>
PATCH v2 1/1 net/bnxt: fix build failure
Fix build failures because of uninitialized variables.
../drivers/net/bnxt/tf_ulp/ulp_mapper.c: 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 [-Werror=maybe-uninitialized]
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 [-Werror=maybe-uninitialized]
../drivers/net/bnxt/tf_core/dpool.c: In function ‘dpool_defrag’:../drivers/net/bnxt/tf_core/dpool.c:95:18: error: ‘index’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
95 | uint32_t index;
| ^~~~~
---v1->v2: update commit log to show the build error encountered.
--- drivers/net/bnxt/tf_core/dpool.c | 1 + drivers/net/bnxt/tf_ulp/ulp_mapper.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_core/dpool.c +1 -0
@@ -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)) {
drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -1
@@ -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;
Signature · 1 line
2.21.1 (Apple Git-122.3)
Quoted 20 lines · Ajit Khaparde
Fix build failures because of uninitialized variables.
../drivers/net/bnxt/tf_ulp/ulp_mapper.c: 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 [-Werror=maybe-uninitialized]
2252 | structbnxt_ulp_glb_resource_infoglb_res;
| ^~~~~~~../drivers/net/bnxt/tf_ulp/ulp_mapper.c:2252:43: error:
‘glb_res.resource_type’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../drivers/net/bnxt/tf_core/dpool.c: In function ‘dpool_defrag’:../drivers/net/bnxt/tf_core/dpool.c:95:18: error: ‘index’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
95 |uint32_tindex;
| ^~~~~
Quoted 8 lines
Fixes 05b405d58148 ("net/bnxt: add dpool allocator for EM allocation")Signed-off-by Kishore Padmanabha <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>---
v1->v2: update commit log to show the build error encountered.
---
Patch applied to dpdk-next-net-brcm for-next-net branch. Thanks
Quoted 36 lines
drivers/net/bnxt/tf_core/dpool.c | 1 + drivers/net/bnxt/tf_ulp/ulp_mapper.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)drivers/net/bnxt/tf_core/dpool.c +1
-0@@ -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)) {drivers/net/bnxt/tf_ulp/ulp_mapper.c +1
-1@@ -2249,7 +2249,7 @@ ulp_mapper_index_tbl_process(structbnxt_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;--
2.21.1 (Apple Git-122.3)
09/07/2021 20:38, Ajit Khaparde:
Quoted 23 lines
Quoted 20 lines · Ajit Khaparde
Fix build failures because of uninitialized variables.
../drivers/net/bnxt/tf_ulp/ulp_mapper.c: 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 [-Werror=maybe-uninitialized]
2252 | structbnxt_ulp_glb_resource_infoglb_res;
| ^~~~~~~../drivers/net/bnxt/tf_ulp/ulp_mapper.c:2252:43: error:
‘glb_res.resource_type’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
../drivers/net/bnxt/tf_core/dpool.c: In function ‘dpool_defrag’:../drivers/net/bnxt/tf_core/dpool.c:95:18: error: ‘index’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
95 |uint32_tindex;
| ^~~~~
Quoted 6 lines
Quoted 4 lines
Fixes 05b405d58148 ("net/bnxt: add dpool allocator for EM allocation")Signed-off-by Kishore Padmanabha <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>Patch applied to dpdk-next-net-brcm for-next-net branch. Thanks
Pulled in main with additional info:
seen on Fedora Core 34 (GCC 11)
Quoted 7 lines · Thomas Monjalon
09/07/2021 00:49, Ajit Khaparde:
Quoted 1 line
Fix build failures because of uninitialized variable usage.
You should add the error log here.
You don't mention the condition of failure.
Nobody reproduced a failure so far.
Hi Thomas,
This addresses FC34 (which I think is using gcc11) build failures, there is an example here:
http://mails.dpdk.org/archives/test-report/2021-July/203186.html
Regards,
Lance