@samitouri / QOSamiQemu / commits / 71fe290540

net/af-xdp.c: maybe-uninitialized warning with gcov build on ubuntu2404

This is a false positive, fixed by explicitly initializing variable to NULL. Variable is always initialized during the for loop above, which is guaranteed to run since queues >= 1. This is correctly detected for normal builds, but not for gcov builds. In function ‘af_xdp_read_poll’, inlined from ‘net_init_af_xdp’ at ../net/af-xdp.c:546:5: ../net/af-xdp.c:78:10: error: ‘s’ may be used uninitialized [-Werror=maybe-uninitialized] 78 | if (s->read_poll != enable) { | ~^~~~~~~~~~~ ../net/af-xdp.c: In function ‘net_init_af_xdp’: ../net/af-xdp.c:461:17: note: ‘s’ was declared here 461 | AFXDPState *s; | Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Link: https://lore.kernel.org/qemu-devel/20260610192222.2709135-2-pierrick.bouvier@oss.qualcomm.com Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>

Pierrick Bouvier committed Jun 10, 2026 at 12:22 UTC 71fe2905408c4b91842f0fa467aa65c79abbcd49
1 file changed +1 -1
net/af-xdp.c
+1 -1
@@ -458,7 +458,7 @@ int net_init_af_xdp(const Netdev *netdev,
458 g_autofree int *sock_fds = NULL;
459 int i, queues;
460 Error *err = NULL;
461 - AFXDPState *s;
461 + AFXDPState *s = NULL;
462 bool inhibit;
463
464 ifindex = if_nametoindex(opts->ifname);