[v1] examples/ip_pipeline: fix build issue with GCC 13

Message ID 20230502134923.3536075-1-jerinj@marvell.com (mailing list archive)
State Not Applicable, archived
Delegated to: Thomas Monjalon
Headers
Series [v1] examples/ip_pipeline: fix build issue with GCC 13 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Jerin Jacob Kollanukkaran May 2, 2023, 1:49 p.m. UTC
  From: Jerin Jacob <jerinj@marvell.com>

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")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
 examples/ip_pipeline/thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ali Alnubani May 3, 2023, 8:30 a.m. UTC | #1
> -----Original Message-----
> From: jerinj@marvell.com <jerinj@marvell.com>
> Sent: Tuesday, May 2, 2023 4:49 PM
> To: dev@dpdk.org
> Cc: NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> david.marchand@redhat.com; ferruh.yigit@xilinx.com;
> stephen@networkplumber.org; Jerin Jacob <jerinj@marvell.com>;
> stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v1] examples/ip_pipeline: fix build issue with
> GCC 13
> 
> From: Jerin Jacob <jerinj@marvell.com>
> 
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> ---

Resolves the warning I see in Bugzilla 1220, thanks.

Now I see a failure in another example app:
"""
examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get' accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]
"""
Will open a separate issue for that.

Tested-by: Ali Alnubani <alialnu@nvidia.com>
  
Ali Alnubani May 3, 2023, 8:33 a.m. UTC | #2
> -----Original Message-----
> From: Ali Alnubani
> Sent: Wednesday, May 3, 2023 11:30 AM
> To: 'jerinj@marvell.com' <jerinj@marvell.com>; dev@dpdk.org
> Cc: NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> david.marchand@redhat.com; ferruh.yigit@xilinx.com;
> stephen@networkplumber.org; stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v1] examples/ip_pipeline: fix build issue with
> GCC 13
> 
> > -----Original Message-----
> > From: jerinj@marvell.com <jerinj@marvell.com>
> > Sent: Tuesday, May 2, 2023 4:49 PM
> > To: dev@dpdk.org
> > Cc: NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> > david.marchand@redhat.com; ferruh.yigit@xilinx.com;
> > stephen@networkplumber.org; Jerin Jacob <jerinj@marvell.com>;
> > stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH v1] examples/ip_pipeline: fix build issue with
> > GCC 13
> >
> > From: Jerin Jacob <jerinj@marvell.com>
> >
> > 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")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> > ---
> 
> Resolves the warning I see in Bugzilla 1220, thanks.
> 
> Now I see a failure in another example app:
> """
> examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get' accessing 8
> bytes in a region of size 0 [-Werror=stringop-overflow=]
> """
> Will open a separate issue for that.

Nevermind, I see it's already addressed in this patch:
https://patches.dpdk.org/project/dpdk/patch/20230502135045.3541570-2-jerinj@marvell.com/

Thanks!
  

Patch

diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c
index 82d5f87c38..9817657ca9 100644
--- a/examples/ip_pipeline/thread.c
+++ b/examples/ip_pipeline/thread.c
@@ -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);