Skip to contentSkip to conversation

service: fix compilation error

PATCH In review Yi Yang 2 participants 3 messages Sep 20, 2017 – Sep 21, 2017

lore
Share & tools
lore

Yi Yang

author
#0 lore raw

PATCH 1/1 service: fix compilation error

CC rte_service.o ./dpdk/lib/librte_eal/common/rte_service.c: In function
‘rte_service_start_with_defaults’:
./dpdk/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);

cc1: all warnings being treated as errors
./dpdk/mk/internal/rte.compile-pre.mk:138:
recipe for target 'rte_service.o' failed

---
 lib/librte_eal/common/rte_service.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/common/rte_service.c +1 -1
index 43716bb..e598e16 100644
@@ -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)
Signature · 1 line
2.1.0
#1 lore raw
Quoted 14 lines

From: Yang, Yi Y
Sent: Wednesday, September 20, 2017 9:31 AM
To: Van Haaren, Harry <[email protected]>
Cc: [email protected]; Yang, Yi Y <[email protected]>
Subject: [PATCH] service: fix compilation error

CC rte_service.o ./dpdk/lib/librte_eal/common/rte_service.c: In function
‘rte_service_start_with_defaults’:
./dpdk/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);

Quoted 5 lines

cc1: all warnings being treated as errors ./dpdk/mk/internal/rte.compile-pre.mk:138:
recipe for target 'rte_service.o' failed

Hi Yi,

Would you provide a more descriptive commit title and message please? The compilation output should not be included in the commit message, instead a short description of what the error is, and what steps can be taken to reproduce the error are much more helpful.

The code changes look OK to me - but I'd like to be able to catch these issues in future, so steps to reproduce are valuable to me.

Thanks, -Harry

Quoted 20 lines
---
 lib/librte_eal/common/rte_service.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/common/rte_service.c +1 -2
index 43716bb..e598e16 100644
@@ -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.0

author
#2 lore raw
Quoted 28 lines · Harry
Quoted 14 lines

From: Yang, Yi Y
Sent: Wednesday, September 20, 2017 9:31 AM
To: Van Haaren, Harry <[email protected]>
Cc: [email protected]; Yang, Yi Y <[email protected]>
Subject: [PATCH] service: fix compilation error

CC rte_service.o ./dpdk/lib/librte_eal/common/rte_service.c: In function
‘rte_service_start_with_defaults’:
./dpdk/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);

Quoted 5 lines

cc1: all warnings being treated as errors ./dpdk/mk/internal/rte.compile-pre.mk:138:
recipe for target 'rte_service.o' failed

Hi Yi,

Would you provide a more descriptive commit title and message please? The compilation output should not be included in the commit message, instead a short description of what the error is, and what steps can be taken to reproduce the error are much more helpful.

Quoted 5 lines

The code changes look OK to me - but I'd like to be able to catch these issues in future, so steps to reproduce are valuable to me.

Thanks, -Harry

Harry, normal DPDK make everybody does usually will trigger this on current master tree, I'm not sure if it is gcc version related. On my Fedora 21, it can be reproduced very easily. I met it when I fixed another vhost bug, I can't build DPDK without it, that is why I want to commit it to you :-)

I have posted out v2 with more descriptive title and git log body per your comments. Thanks a lot for your review.

Quoted 23 lines
Quoted 22 lines

---
 lib/librte_eal/common/rte_service.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/common/rte_service.c +1 -2
index 43716bb..e598e16 100644
@@ -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.0