diff options
| author | Mat Martineau <mathew.j.martineau@linux.intel.com> | 2025-07-31 13:23:58 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-08-28 16:24:33 +0200 |
| commit | 13e85f7d6979e20f03cc7157c65910770ec99530 (patch) | |
| tree | abc2e2b38e28643391d25eb1fc89b8fac2be2ee1 /tools | |
| parent | c9f8a3b0600b8475cecc4328146058361df72521 (diff) | |
| download | linux-13e85f7d6979e20f03cc7157c65910770ec99530.tar.gz linux-13e85f7d6979e20f03cc7157c65910770ec99530.tar.bz2 linux-13e85f7d6979e20f03cc7157c65910770ec99530.zip | |
selftests: mptcp: Initialize variables to quiet gcc 12 warnings
commit fd37c2ecb21f7aee04ccca5f561469f07d00063c upstream.
In a few MPTCP selftest tools, gcc 12 complains that the 'sock' variable
might be used uninitialized. This is a false positive because the only
code path that could lead to uninitialized access is where getaddrinfo()
fails, but the local xgetaddrinfo() wrapper exits if such a failure
occurs.
Initialize the 'sock' variable anyway to allow the tools to build with
gcc 12.
Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ mptcp_inq.c and mptcp_sockopt.c are not in this version. The fix can
still be applied in mptcp_connect.c without conflicts. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c index d505c6cba668..cb2284ad4e65 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c @@ -188,7 +188,7 @@ static void set_mark(int fd, uint32_t mark) static int sock_listen_mptcp(const char * const listenaddr, const char * const port) { - int sock; + int sock = -1; struct addrinfo hints = { .ai_protocol = IPPROTO_TCP, .ai_socktype = SOCK_STREAM, |
