summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Zanni <alessandro.zanni87@gmail.com>2025-10-23 22:53:52 +0200
committerJakub Kicinski <kuba@kernel.org>2025-10-24 18:43:37 -0700
commit13cb6ac5b506d510d5d57128ff9d99541aae886e (patch)
tree5058928fa0eafbde99357b2016013a2761cb6922
parent612868762544bd08d3800b7bbf9331b8abaa64ec (diff)
selftest: net: prevent use of uninitialized variable
Fix to avoid the usage of the `ret` variable uninitialized in the following macro expansions. It solves the following warning: In file included from netlink-dumps.c:21: netlink-dumps.c: In function ‘dump_extack’: ../kselftest_harness.h:788:35: warning: ‘ret’ may be used uninitialized [-Wmaybe-uninitialized] 788 | intmax_t __exp_print = (intmax_t)__exp; \ | ^~~~~~~~~~~ ../kselftest_harness.h:631:9: note: in expansion of macro ‘__EXPECT’ 631 | __EXPECT(expected, #expected, seen, #seen, ==, 0) | ^~~~~~~~ netlink-dumps.c:169:9: note: in expansion of macro ‘EXPECT_EQ’ 169 | EXPECT_EQ(ret, FOUND_EXTACK); | ^~~~~~~~~ The issue can be reproduced, building the tests, with the command: make -C tools/testing/selftests TARGETS=net Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com> Link: https://patch.msgid.link/20251023205354.28249-1-alessandro.zanni87@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--tools/testing/selftests/net/netlink-dumps.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/netlink-dumps.c b/tools/testing/selftests/net/netlink-dumps.c
index 7618ebe528a4..679b6c77ace7 100644
--- a/tools/testing/selftests/net/netlink-dumps.c
+++ b/tools/testing/selftests/net/netlink-dumps.c
@@ -143,6 +143,7 @@ TEST(dump_extack)
EXPECT_EQ(n, -1);
EXPECT_EQ(errno, ENOBUFS);
+ ret = NO_CTRL;
for (i = 0; i < cnt; i++) {
struct ext_ack ea = {};