Skip to contentSkip to conversation

examples/ip_pipeline: fix build issue with GCC 13

PATCH Applied [email protected] 7 participants 12 messages May 2, 2023 – May 11, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/ip_pipeline: fix build issue with GCC 13

From: Jerin Jacob <[email protected]>

Fix the following build issue by initializing req to NULL for the local variable.

In function 'thread_msg_handle', inlined from 'thread_main' at ../examples/ip_pipeline/thread.c:3130:6:
../examples/ip_pipeline/thread.c:535:20: warning: 'req' may be used uninitialized [-Wmaybe-uninitialized]
535 | if (req == NULL)
| ^
../examples/ip_pipeline/thread.c: In function 'thread_main':
../examples/ip_pipeline/thread.c:433:32: note: 'req' was declared here
433 | struct thread_msg_req *req;

Bugzilla ID: 1220

Fixes a8bd581de397 ("examples/ip_pipeline: add thread runtime")
---
 examples/ip_pipeline/thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ip_pipeline/thread.c +1 -1
index 82d5f87c38..9817657ca9 100644
@@ -430,7 +430,7 @@ thread_pipeline_disable(uint32_t thread_id,
 static inline struct thread_msg_req *
 thread_msg_recv(struct rte_ring *msgq_req)
 {
-	struct thread_msg_req *req;
+	struct thread_msg_req *req = NULL;
 
 	int status = rte_ring_sc_dequeue(msgq_req, (void **) &req);
 
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/1 examples/ntb: fix build issue with GCC 13

From: Jerin Jacob <[email protected]>

Fix the following build issue by not allowing nb_ids to be zero. nb_ids can be zero based on rte_rawdev_xstats_get() API documentation but it is not valid for the case when second argument is NULL.

examples/ntb/ntb_fwd.c: In function 'ntb_stats_display':
examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get' accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]

  945 | if (nb_ids != rte_rawdev_xstats_get(dev_id, ids, values, nb_ids)) {
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

examples/ntb/ntb_fwd.c:945:23: note: referencing argument 3 of type 'uint64_t[0]' {aka 'long unsigned int[]'} In file included from ../examples/ntb/ntb_fwd.c:17:
lib/rawdev/rte_rawdev.h:504:1: note: in a call to function 'rte_rawdev_xstats_get'
504 | rte_rawdev_xstats_get(uint16_t dev_id,

Fixes 5194299d6ef5 ("examples/ntb: support more functions")
---
 examples/ntb/ntb_fwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ntb/ntb_fwd.c +1 -1
index f9abed28e4..5489c3b3cd 100644
@@ -923,7 +923,7 @@ ntb_stats_display(void)
 
 	/* Get NTB dev stats and stats names */
 	nb_ids = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
-	if (nb_ids  < 0) {
+	if (nb_ids <= 0) {
 		printf("Error: Cannot get count of xstats\n");
 		return;
 	}
Signature · 1 line
2.40.1
Tested-by on v1 1/1
#2 lore raw

RE: [dpdk-dev] [PATCH v1] examples/ntb: fix build issue with GCC 13

Quoted 31 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Tuesday, May 2, 2023 4:51 PM
To: [email protected]; Jingjing Wu <[email protected]>; Junfeng Guo <[email protected]>; Xiaoyun Li <[email protected]>
Cc: NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v1] examples/ntb: fix build issue with GCC 13

From: Jerin Jacob <[email protected]>

Fix the following build issue by not allowing nb_ids to be zero. nb_ids can be zero based on rte_rawdev_xstats_get() API documentation but it is not valid for the case when second argument is NULL.

examples/ntb/ntb_fwd.c: In function 'ntb_stats_display':
examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get' accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]

  945 | if (nb_ids != rte_rawdev_xstats_get(dev_id, ids, values, nb_ids)) {
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

examples/ntb/ntb_fwd.c:945:23: note: referencing argument 3 of type 'uint64_t[0]' {aka 'long unsigned int[]'} In file included from ../examples/ntb/ntb_fwd.c:17:
lib/rawdev/rte_rawdev.h:504:1: note: in a call to function 'rte_rawdev_xstats_get'
504 | rte_rawdev_xstats_get(uint16_t dev_id,

Quoted 4 lines
Fixes 5194299d6ef5 ("examples/ntb: support more functions")

---

Resolves the build failure for me on Fedora 38 with gcc 13.1.1.

#3 lore raw

RE: [dpdk-dev] [PATCH v1] examples/ntb: fix build issue with GCC 13

In reply to [email protected]
Quoted 12 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Tuesday, May 2, 2023 21:51
To: [email protected]; Wu, Jingjing <[email protected]>; Guo, Junfeng <[email protected]>; Li, Xiaoyun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v1] examples/ntb: fix build issue with GCC 13

Quoted 6 lines

From: Jerin Jacob <[email protected]>

Fix the following build issue by not allowing nb_ids to be zero. nb_ids can be zero based on rte_rawdev_xstats_get() API documentation but it is not valid for the case when second argument is NULL.

Is this the new standard for GCC 13?

Quoted 27 lines

examples/ntb/ntb_fwd.c: In function 'ntb_stats_display':
examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get' accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]

  945 | if (nb_ids != rte_rawdev_xstats_get(dev_id, ids, values, nb_ids)) {
      |

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

examples/ntb/ntb_fwd.c:945:23: note: referencing argument 3 of type 'uint64_t[0]' {aka 'long unsigned int[]'} In file included from ../examples/ntb/ntb_fwd.c:17:
lib/rawdev/rte_rawdev.h:504:1: note: in a call to function 'rte_rawdev_xstats_get'
504 | rte_rawdev_xstats_get(uint16_t dev_id,

Fixes 5194299d6ef5 ("examples/ntb: support more functions")
---
 examples/ntb/ntb_fwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ntb/ntb_fwd.c +0 -0
index f9abed28e4..5489c3b3cd 100644

examples/ntb/ntb_fwd.c ntb_stats_display(void) · line 926

Quoted 5 lines
examples/ntb/ntb_fwd.c +1 -1
@@ -923,7 +923,7 @@ ntb_stats_display(void)
 
 	/* Get NTB dev stats and stats names */
 	nb_ids = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
-	if (nb_ids  < 0) {
+	if (nb_ids <= 0) {

Should the one in func ntb_stats_clear also be updated non-zero?

Quoted 5 lines
examples/ntb/ntb_fwd.c +0 -1
 		printf("Error: Cannot get count of xstats\n");
 		return;
 	}
--

2.40.1

#4 lore raw

Re: [dpdk-dev] [PATCH v1] examples/ntb: fix build issue with GCC 13

Quoted 13 lines · Junfeng
Quoted 13 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Tuesday, May 2, 2023 21:51
To: [email protected]; Wu, Jingjing <[email protected]>; Guo, Junfeng <[email protected]>; Li, Xiaoyun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v1] examples/ntb: fix build issue with GCC 13

Quoted 8 lines
Quoted 6 lines

From: Jerin Jacob <[email protected]>

Fix the following build issue by not allowing nb_ids to be zero. nb_ids can be zero based on rte_rawdev_xstats_get() API documentation but it is not valid for the case when second argument is NULL.

Is this the new standard for GCC 13?

No. Looks like optimization from compiler. It is able to detect their case for zero memory allocation.

Quoted 29 lines
Quoted 29 lines

examples/ntb/ntb_fwd.c: In function 'ntb_stats_display':
examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get' accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]

  945 | if (nb_ids != rte_rawdev_xstats_get(dev_id, ids, values, nb_ids)) {
      |

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

examples/ntb/ntb_fwd.c:945:23: note: referencing argument 3 of type 'uint64_t[0]' {aka 'long unsigned int[]'} In file included from ../examples/ntb/ntb_fwd.c:17:
lib/rawdev/rte_rawdev.h:504:1: note: in a call to function 'rte_rawdev_xstats_get'
504 | rte_rawdev_xstats_get(uint16_t dev_id,

Fixes 5194299d6ef5 ("examples/ntb: support more functions")
---
 examples/ntb/ntb_fwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ntb/ntb_fwd.c +0 -0
index f9abed28e4..5489c3b3cd 100644
@@ -923,7 +923,7 @@ ntb_stats_display(void)
 
Quoted 6 lines

examples/ntb/ntb_fwd.c ntb_stats_display(void) · line 926

Quoted 4 lines
examples/ntb/ntb_fwd.c +1 -1
      /* Get NTB dev stats and stats names */
      nb_ids = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
-     if (nb_ids  < 0) {
+     if (nb_ids <= 0) {

Should the one in func ntb_stats_clear also be updated non-zero?

Some reason compiler is not detecting it. I will fix in next version.

Quoted 7 lines
Quoted 6 lines
examples/ntb/ntb_fwd.c +0 -1
              printf("Error: Cannot get count of xstats\n");
              return;
      }
--

2.40.1

#5 lore raw

PATCH v2 1/1 examples/ntb: fix build issue with GCC 13

In reply to [email protected]

From: Jerin Jacob <[email protected]>

Fix the following build issue by not allowing nb_ids to be zero. nb_ids can be zero based on rte_rawdev_xstats_get() API documentation but it is not valid for the case when second argument is NULL.

examples/ntb/ntb_fwd.c: In function 'ntb_stats_display':
examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get' accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]

  945 | if (nb_ids != rte_rawdev_xstats_get(dev_id, ids, values, nb_ids)) {
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

examples/ntb/ntb_fwd.c:945:23: note: referencing argument 3 of type 'uint64_t[0]' {aka 'long unsigned int[]'} In file included from ../examples/ntb/ntb_fwd.c:17:
lib/rawdev/rte_rawdev.h:504:1: note: in a call to function 'rte_rawdev_xstats_get'
504 | rte_rawdev_xstats_get(uint16_t dev_id,

Fixes 5194299d6ef5 ("examples/ntb: support more functions")

---
v2:
- Apply the same fix for ntb_stats_clear()(Junfeng)

 examples/ntb/ntb_fwd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/ntb/ntb_fwd.c +2 -2
index f9abed28e4..585aad9d70 100644
@@ -865,7 +865,7 @@ ntb_stats_clear(void)
 
 	/* Clear NTB dev stats */
 	nb_ids = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
-	if (nb_ids  < 0) {
+	if (nb_ids <= 0) {
 		printf("Error: Cannot get count of xstats\n");
 		return;
 	}
@@ -923,7 +923,7 @@ ntb_stats_display(void)
 
 	/* Get NTB dev stats and stats names */
 	nb_ids = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
-	if (nb_ids  < 0) {
+	if (nb_ids <= 0) {
 		printf("Error: Cannot get count of xstats\n");
 		return;
 	}
Signature · 1 line
2.40.1
Acked-by on v2 1/1
#6 lore raw

RE: [dpdk-dev] [PATCH v2] examples/ntb: fix build issue with GCC 13

Quoted 50 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Thursday, May 4, 2023 16:54
To: [email protected]; Wu, Jingjing <[email protected]>; Guo, Junfeng <[email protected]>; Li, Xiaoyun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>; [email protected]; Ali Alnubani <[email protected]>
Subject: [dpdk-dev] [PATCH v2] examples/ntb: fix build issue with GCC 13

From: Jerin Jacob <[email protected]>

Fix the following build issue by not allowing nb_ids to be zero. nb_ids can be zero based on rte_rawdev_xstats_get() API documentation but it is not valid for the case when second argument is NULL.

examples/ntb/ntb_fwd.c: In function 'ntb_stats_display':
examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get' accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]

  945 | if (nb_ids != rte_rawdev_xstats_get(dev_id, ids, values, nb_ids)) {
      |

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

examples/ntb/ntb_fwd.c:945:23: note: referencing argument 3 of type 'uint64_t[0]' {aka 'long unsigned int[]'} In file included from ../examples/ntb/ntb_fwd.c:17:
lib/rawdev/rte_rawdev.h:504:1: note: in a call to function 'rte_rawdev_xstats_get'
504 | rte_rawdev_xstats_get(uint16_t dev_id,

Fixes 5194299d6ef5 ("examples/ntb: support more functions")

---
v2:
- Apply the same fix for ntb_stats_clear()(Junfeng)

 examples/ntb/ntb_fwd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
examples/ntb/ntb_fwd.c +0 -1
index f9abed28e4..585aad9d70 100644
@@ -865,7 +865,7 @@ ntb_stats_clear(void)
--
Quoted 1 line

2.40.1

LGTM, it makes sense to avoid zero memory allocation. Thanks!

Regards,
Junfeng Guo

Tested-by on v2 1/1
#7 lore raw

RE: [dpdk-dev] [PATCH v2] examples/ntb: fix build issue with GCC 13

In reply to [email protected]
Quoted 30 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: 2023年5月4日 16:54
To: [email protected]; Wu, Jingjing <[email protected]>; Guo, Junfeng <[email protected]>; Li, Xiaoyun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>; [email protected]; Ali Alnubani <[email protected]>
Subject: [dpdk-dev] [PATCH v2] examples/ntb: fix build issue with GCC 13

From: Jerin Jacob <[email protected]>

Fix the following build issue by not allowing nb_ids to be zero. nb_ids can be zero based on rte_rawdev_xstats_get() API documentation but it is not valid for the case when second argument is NULL.

examples/ntb/ntb_fwd.c: In function 'ntb_stats_display':
examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get' accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]

  945 | if (nb_ids != rte_rawdev_xstats_get(dev_id, ids, values, nb_ids)) {
      |

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

examples/ntb/ntb_fwd.c:945:23: note: referencing argument 3 of type 'uint64_t[0]' {aka 'long unsigned int[]'} In file included from ../examples/ntb/ntb_fwd.c:17:
lib/rawdev/rte_rawdev.h:504:1: note: in a call to function 'rte_rawdev_xstats_get'
504 | rte_rawdev_xstats_get(uint16_t dev_id,

Quoted 4 lines
Fixes 5194299d6ef5 ("examples/ntb: support more functions")
Acked-by Junfeng Guo Tested-by Daxue Gao on v2 1/1 Applied
#8 lore raw

Re: [dpdk-dev] [PATCH v2] examples/ntb: fix build issue with GCC 13

In reply to [email protected]
Quoted 21 lines · On Thu, May 4, 2023 at 10:54 AM <[email protected]> wrote:

From: Jerin Jacob <[email protected]>

Fix the following build issue by not allowing nb_ids to be zero. nb_ids can be zero based on rte_rawdev_xstats_get() API documentation but it is not valid for the case when second argument is NULL.

examples/ntb/ntb_fwd.c: In function 'ntb_stats_display':
examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get' accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]

  945 | if (nb_ids != rte_rawdev_xstats_get(dev_id, ids, values, nb_ids)) {
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

examples/ntb/ntb_fwd.c:945:23: note: referencing argument 3 of type 'uint64_t[0]' {aka 'long unsigned int[]'} In file included from ../examples/ntb/ntb_fwd.c:17:
lib/rawdev/rte_rawdev.h:504:1: note: in a call to function 'rte_rawdev_xstats_get'
504 | rte_rawdev_xstats_get(uint16_t dev_id,

Quoted 5 lines
Fixes 5194299d6ef5 ("examples/ntb: support more functions")

Applied, thanks.

Signature · 1 line
David Marchand
Acked-by on v1 1/1
#9 lore raw
In reply to [email protected]
Quoted 27 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Tuesday, May 2, 2023 2:51 PM
To: [email protected]; Dumitrescu, Cristian <[email protected]>; Singh, Jasvinder <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v1] examples/ip_pipeline: fix build issue with GCC 13

From: Jerin Jacob <[email protected]>

Fix the following build issue by initializing req to NULL for the local variable.

In function 'thread_msg_handle', inlined from 'thread_main' at ../examples/ip_pipeline/thread.c:3130:6:
../examples/ip_pipeline/thread.c:535:20: warning: 'req' may be used uninitialized [-Wmaybe-uninitialized]
535 | if (req == NULL)
| ^
../examples/ip_pipeline/thread.c: In function 'thread_main':
../examples/ip_pipeline/thread.c:433:32: note: 'req' was declared here
433 | struct thread_msg_req *req;

Quoted 6 lines

Bugzilla ID: 1220

Fixes a8bd581de397 ("examples/ip_pipeline: add thread runtime")

---

Tested-by on v1 1/1
#10 lore raw
In reply to [email protected]
Quoted 26 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: 2023年5月2日 21:51
To: [email protected]; Dumitrescu, Cristian <[email protected]>; Singh, Jasvinder <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v1] examples/ip_pipeline: fix build issue with GCC 13

From: Jerin Jacob <[email protected]>

Fix the following build issue by initializing req to NULL for the local variable.

In function 'thread_msg_handle', inlined from 'thread_main' at ../examples/ip_pipeline/thread.c:3130:6:
../examples/ip_pipeline/thread.c:535:20: warning: 'req' may be used uninitialized [-Wmaybe-uninitialized]
535 | if (req == NULL)
| ^
../examples/ip_pipeline/thread.c: In function 'thread_main':
../examples/ip_pipeline/thread.c:433:32: note: 'req' was declared here
433 | struct thread_msg_req *req;

Quoted 5 lines

Bugzilla ID: 1220

Fixes a8bd581de397 ("examples/ip_pipeline: add thread runtime")
Acked-by Cristian Dumitrescu Tested-by Ali Alnubani Tested-by Daxue Gao on v1 1/1 Applied
#11 lore raw
In reply to [email protected]
Quoted 16 lines · On Tue, May 2, 2023 at 3:51 PM <[email protected]> wrote:

From: Jerin Jacob <[email protected]>

Fix the following build issue by initializing req to NULL for the local variable.

In function 'thread_msg_handle', inlined from 'thread_main' at ../examples/ip_pipeline/thread.c:3130:6:
../examples/ip_pipeline/thread.c:535:20: warning: 'req' may be used uninitialized [-Wmaybe-uninitialized]
535 | if (req == NULL)
| ^
../examples/ip_pipeline/thread.c: In function 'thread_main':
../examples/ip_pipeline/thread.c:433:32: note: 'req' was declared here
433 | struct thread_msg_req *req;

Quoted 5 lines

Bugzilla ID: 1220

Fixes a8bd581de397 ("examples/ip_pipeline: add thread runtime")

Applied, thanks.

Signature · 1 line
David Marchand