Skip to contentSkip to conversation

FAILED: patch "[PATCH] selftests: mptcp: Initialize variables to quiet gcc 12" failed to apply to 5.15-stable tree

PATCH [email protected] 1 participant 1 message Jul 4, 2022

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From fd37c2ecb21f7aee04ccca5f561469f07d00063c Mon Sep 17 00:00:00 2001
From: Mat Martineau <[email protected]>
Date: Mon, 27 Jun 2022 18:02:43 -0700
Subject: [PATCH] selftests: mptcp: Initialize variables to quiet gcc 12
warnings

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")
tools/testing/selftests/net/mptcp/mptcp_connect.c +1 -1
index 8628aa61b763..e2ea6c126c99 100644
@@ -265,7 +265,7 @@ static void sock_test_tcpulp(int sock, int proto, unsigned int line)
 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,
tools/testing/selftests/net/mptcp/mptcp_inq.c +1 -1
index 29f75e2a1116..8672d898f8cd 100644
@@ -88,7 +88,7 @@ static void xgetaddrinfo(const char *node, const char *service,
 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,
tools/testing/selftests/net/mptcp/mptcp_sockopt.c +1 -1
index ac9a4d9c1764..ae61f39556ca 100644
@@ -136,7 +136,7 @@ static void xgetaddrinfo(const char *node, const char *service,
 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,