public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] selftest: net: prevent use of uninitialized variable
@ 2025-10-23 20:53 Alessandro Zanni
  2025-10-25  1:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Alessandro Zanni @ 2025-10-23 20:53 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, horms, shuah
  Cc: Alessandro Zanni, netdev, linux-kselftest, linux-kernel

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>
---

Notes:
    v2: applied the reverse christmas tree order

 tools/testing/selftests/net/netlink-dumps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/netlink-dumps.c b/tools/testing/selftests/net/netlink-dumps.c
index 7618ebe528a4..7de360c029c6 100644
--- a/tools/testing/selftests/net/netlink-dumps.c
+++ b/tools/testing/selftests/net/netlink-dumps.c
@@ -111,8 +111,8 @@ static const struct {
 
 TEST(dump_extack)
 {
+	int i, cnt, ret = 0;
 	int netlink_sock;
-	int i, cnt, ret;
 	char buf[8192];
 	int one = 1;
 	ssize_t n;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] selftest: net: prevent use of uninitialized variable
  2025-10-23 20:53 [PATCH v2] selftest: net: prevent use of uninitialized variable Alessandro Zanni
@ 2025-10-25  1:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-25  1:50 UTC (permalink / raw)
  To: Alessandro Zanni
  Cc: davem, edumazet, kuba, pabeni, horms, shuah, netdev,
	linux-kselftest, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 23 Oct 2025 22:53:52 +0200 you wrote:
> 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);
>       |         ^~~~~~~~~
> 
> [...]

Here is the summary with links:
  - [v2] selftest: net: prevent use of uninitialized variable
    https://git.kernel.org/netdev/net-next/c/13cb6ac5b506

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-25  1:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23 20:53 [PATCH v2] selftest: net: prevent use of uninitialized variable Alessandro Zanni
2025-10-25  1:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox