diff mbox series

[ovs-dev] netdev-dpdk: fix warning with gcc 13

Message ID 20230530142218.118720-1-rjarry@redhat.com
State Superseded
Headers show
Series [ovs-dev] netdev-dpdk: fix warning with gcc 13 | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Robin Jarry May 30, 2023, 2:22 p.m. UTC
GCC now reports uninitialized warnings from function return values.

../lib/netdev-dpdk.c: In function 'netdev_dpdk_mempool_configure':
../lib/netdev-dpdk.c:964:22: warning: 'dmp' may be used uninitialized [-Wmaybe-uninitialized]
  964 |         dev->dpdk_mp = dmp;
      |         ~~~~~~~~~~~~~^~~~~
../lib/netdev-dpdk.c:854:21: note: 'dmp' was declared here
  854 |     struct dpdk_mp *dmp, *next;
      |                     ^~~

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 lib/netdev-dpdk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Marchand May 31, 2023, 7:30 a.m. UTC | #1
In OVS, commit titles start with a capital letter and ends with a .
I suggest:
netdev-dpdk: Fix build with gcc 13.


On Tue, May 30, 2023 at 4:23 PM Robin Jarry <rjarry@redhat.com> wrote:
>
> GCC now reports uninitialized warnings from function return values.
>
> ../lib/netdev-dpdk.c: In function 'netdev_dpdk_mempool_configure':
> ../lib/netdev-dpdk.c:964:22: warning: 'dmp' may be used uninitialized [-Wmaybe-uninitialized]
>   964 |         dev->dpdk_mp = dmp;
>       |         ~~~~~~~~~~~~~^~~~~
> ../lib/netdev-dpdk.c:854:21: note: 'dmp' was declared here
>   854 |     struct dpdk_mp *dmp, *next;
>       |                     ^~~
>
> Signed-off-by: Robin Jarry <rjarry@redhat.com>

This looks like a false positive to me..
gcc 13 probably fails to see the link between reuse and dmp.

I don't have a better idea to make gcc happy and your proposal is
simple so I am ok with it.
If you send a v2, feel free to add:
Reviewed-by: David Marchand <david.marchand@redhat.com>
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 9f380a910e9f..829764c59550 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -851,7 +851,7 @@  dpdk_mp_create(struct netdev_dpdk *dev, int mtu)
 static struct dpdk_mp *
 dpdk_mp_get(struct netdev_dpdk *dev, int mtu)
 {
-    struct dpdk_mp *dmp, *next;
+    struct dpdk_mp *dmp = NULL, *next;
     bool reuse = false;
 
     ovs_mutex_lock(&dpdk_mp_mutex);