[dpdk-dev] [PATCH] eal: fix service array initialisation

Nelio Laranjeiro nelio.laranjeiro at 6wind.com
Thu Sep 21 13:48:16 CEST 2017


GCC is complaining on variable used without being initialised.

 dpdk.org/lib/librte_eal/common/rte_service.c:
 In function ‘rte_service_start_with_defaults’:
 dpdk.org/lib/librte_eal/common/rte_service.c:449:9:
 error: ‘ids[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    ret = rte_service_map_lcore_set(i, ids[lcore_iter], 1);

Fixes: 21698354c832 ("service: introduce service cores concept")
Cc: harry.van.haaren at intel.com

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>
---
 lib/librte_eal/common/rte_service.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index 43716bb..aa05277 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -431,7 +431,7 @@ rte_service_start_with_defaults(void)
 	uint32_t count = rte_service_get_count();
 
 	int32_t lcore_iter = 0;
-	uint32_t ids[RTE_MAX_LCORE];
+	uint32_t ids[RTE_MAX_LCORE] = { 0 };
 	int32_t lcore_count = rte_service_lcore_list(ids, RTE_MAX_LCORE);
 
 	if (lcore_count == 0)
-- 
2.1.4



More information about the dev mailing list