* [dpdk-dev] [PATCH 1/5] eal: fix build with -O1
2018-11-16 16:58 [dpdk-dev] [PATCH 0/5] fix build with option -O1 Thomas Monjalon
@ 2018-11-16 16:58 ` Thomas Monjalon
2018-11-16 16:58 ` [dpdk-dev] [PATCH 2/5] kni: fix possible uninitialized variable Thomas Monjalon
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2018-11-16 16:58 UTC (permalink / raw)
To: dev; +Cc: stable
In case of optimized compilation, RTE_BUILD_BUG_ON use an external
variable which is neither defined, nor used.
It seems not optimized out in case of OPDL compiled with clang -O1:
opdl_ring.c: undefined reference to `RTE_BUILD_BUG_ON_detected_error'
clang-6.0: fatal error: linker command failed with exit code 1
Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_eal/common/include/rte_common.h | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 87f0f6302..57acb8485 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -270,16 +270,7 @@ rte_is_aligned(void *ptr, unsigned align)
/**
* Triggers an error at compilation time if the condition is true.
*/
-#ifndef __OPTIMIZE__
#define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-#else
-extern int RTE_BUILD_BUG_ON_detected_error;
-#define RTE_BUILD_BUG_ON(condition) do { \
- ((void)sizeof(char[1 - 2*!!(condition)])); \
- if (condition) \
- RTE_BUILD_BUG_ON_detected_error = 1; \
-} while(0)
-#endif
/**
* Combines 32b inputs most significant set bits into the least
--
2.19.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 2/5] kni: fix possible uninitialized variable
2018-11-16 16:58 [dpdk-dev] [PATCH 0/5] fix build with option -O1 Thomas Monjalon
2018-11-16 16:58 ` [dpdk-dev] [PATCH 1/5] eal: fix build with -O1 Thomas Monjalon
@ 2018-11-16 16:58 ` Thomas Monjalon
2018-11-16 16:58 ` [dpdk-dev] [PATCH 3/5] net/mlx4: " Thomas Monjalon
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2018-11-16 16:58 UTC (permalink / raw)
To: dev; +Cc: stable
This error can be raised:
lib/librte_kni/rte_kni.c:531:15: error:
'req' may be used uninitialized in this function
It should not happen because kni_fifo_get() would return 0 if
req is not initialized, so the function would return before using req.
But GCC complains about it in -O1 optimization,
and a NULL initialization is harmless here.
Fixes: 3fc5ca2f6352 ("kni: initial import")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_kni/rte_kni.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index c9726d4f8..73aeccccf 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -483,7 +483,7 @@ int
rte_kni_handle_request(struct rte_kni *kni)
{
unsigned ret;
- struct rte_kni_request *req;
+ struct rte_kni_request *req = NULL;
if (kni == NULL)
return -1;
--
2.19.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 3/5] net/mlx4: fix possible uninitialized variable
2018-11-16 16:58 [dpdk-dev] [PATCH 0/5] fix build with option -O1 Thomas Monjalon
2018-11-16 16:58 ` [dpdk-dev] [PATCH 1/5] eal: fix build with -O1 Thomas Monjalon
2018-11-16 16:58 ` [dpdk-dev] [PATCH 2/5] kni: fix possible uninitialized variable Thomas Monjalon
@ 2018-11-16 16:58 ` Thomas Monjalon
2018-11-16 16:58 ` [dpdk-dev] [PATCH 4/5] eventdev: " Thomas Monjalon
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2018-11-16 16:58 UTC (permalink / raw)
To: dev; +Cc: stable
When compiling with gcc -O1, this error appears:
drivers/net/mlx4/mlx4_ethdev.c: In function ‘mlx4_rxmode_toggle’:
rte_log.h:321:3: error:
‘mode’ may be used uninitialized in this function
The function mlx4_rxmode_toggle is never called with a value which
is not in the switch block, but GCC complains about it with -O1.
So the default case is "fixed" by setting string "undefined".
Fixes: eacaac7bae36 ("net/mlx4: restore promisc and allmulti support")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/mlx4/mlx4_ethdev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index 30deb3ef0..195a1b6df 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -360,6 +360,8 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
mode = "all multicast";
dev->data->all_multicast = toggle & 1;
break;
+ default:
+ mode = "undefined";
}
if (!mlx4_flow_sync(priv, &error))
return;
--
2.19.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 4/5] eventdev: fix possible uninitialized variable
2018-11-16 16:58 [dpdk-dev] [PATCH 0/5] fix build with option -O1 Thomas Monjalon
` (2 preceding siblings ...)
2018-11-16 16:58 ` [dpdk-dev] [PATCH 3/5] net/mlx4: " Thomas Monjalon
@ 2018-11-16 16:58 ` Thomas Monjalon
2018-11-16 16:58 ` [dpdk-dev] [PATCH 5/5] app/eventdev: " Thomas Monjalon
2018-11-23 0:26 ` [dpdk-dev] [PATCH 0/5] fix build with option -O1 Thomas Monjalon
5 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2018-11-16 16:58 UTC (permalink / raw)
To: dev; +Cc: nikhil.rao
When compiling with -O1, this error can appear:
lib/librte_eventdev/rte_event_eth_tx_adapter.c:705:6: error:
‘ret’ may be used uninitialized in this function
If tx_queue_id is -1 and nb_queues is 0, then ret is returned
without being initialized.
It is fixed by setting 0 as initial value.
Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: nikhil.rao@intel.com
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_eventdev/rte_event_eth_tx_adapter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
index 3a21defba..ccf8a7550 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
@@ -702,7 +702,7 @@ txa_service_queue_add(uint8_t id,
struct txa_service_queue_info *tqi;
struct rte_eth_dev_tx_buffer *tb;
struct txa_retry *txa_retry;
- int ret;
+ int ret = 0;
txa = txa_service_id_to_data(id);
--
2.19.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 5/5] app/eventdev: fix possible uninitialized variable
2018-11-16 16:58 [dpdk-dev] [PATCH 0/5] fix build with option -O1 Thomas Monjalon
` (3 preceding siblings ...)
2018-11-16 16:58 ` [dpdk-dev] [PATCH 4/5] eventdev: " Thomas Monjalon
@ 2018-11-16 16:58 ` Thomas Monjalon
2018-11-23 0:26 ` [dpdk-dev] [PATCH 0/5] fix build with option -O1 Thomas Monjalon
5 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2018-11-16 16:58 UTC (permalink / raw)
To: dev; +Cc: pbhagavatula
When compiling with -O1, this error can appear:
app/test-eventdev/test_pipeline_common.c:332:6: error:
‘ret’ may be used uninitialized in this function
If there is no device, then ret is returned without being initialized.
It is fixed by setting 0 as initial value.
Fixes: 032a965a8f1d ("app/eventdev: support Tx adapter")
Cc: pbhagavatula@caviumnetworks.com
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-eventdev/test_pipeline_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index d07fa8826..5db3ffde1 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -329,7 +329,7 @@ int
pipeline_event_tx_adapter_setup(struct evt_options *opt,
struct rte_event_port_conf port_conf)
{
- int ret;
+ int ret = 0;
uint16_t consm;
RTE_ETH_FOREACH_DEV(consm) {
--
2.19.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 0/5] fix build with option -O1
2018-11-16 16:58 [dpdk-dev] [PATCH 0/5] fix build with option -O1 Thomas Monjalon
` (4 preceding siblings ...)
2018-11-16 16:58 ` [dpdk-dev] [PATCH 5/5] app/eventdev: " Thomas Monjalon
@ 2018-11-23 0:26 ` Thomas Monjalon
5 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2018-11-23 0:26 UTC (permalink / raw)
To: dev
> Thomas Monjalon (5):
> eal: fix build with -O1
> kni: fix possible uninitialized variable
> net/mlx4: fix possible uninitialized variable
> eventdev: fix possible uninitialized variable
> app/eventdev: fix possible uninitialized variable
Applied
^ permalink raw reply [flat|nested] 7+ messages in thread