From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: netdev@vger.kernel.org
Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>,
davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, fw@strlen.de, geliang.tang@suse.com,
matthieu.baerts@tessares.net, mptcp@lists.linux.dev
Subject: [PATCH net 9/9] selftests: mptcp: Initialize variables to quiet gcc 12 warnings
Date: Mon, 27 Jun 2022 18:02:43 -0700 [thread overview]
Message-ID: <20220628010243.166605-10-mathew.j.martineau@linux.intel.com> (raw)
In-Reply-To: <20220628010243.166605-1-mathew.j.martineau@linux.intel.com>
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>
---
tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +-
tools/testing/selftests/net/mptcp/mptcp_inq.c | 2 +-
tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index 8628aa61b763..e2ea6c126c99 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -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,
diff --git a/tools/testing/selftests/net/mptcp/mptcp_inq.c b/tools/testing/selftests/net/mptcp/mptcp_inq.c
index 29f75e2a1116..8672d898f8cd 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_inq.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_inq.c
@@ -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,
diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
index ac9a4d9c1764..ae61f39556ca 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
@@ -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,
--
2.37.0
next prev parent reply other threads:[~2022-06-28 1:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 1:02 [PATCH net 0/9] mptcp: Fixes for 5.19 Mat Martineau
2022-06-28 1:02 ` [PATCH net 1/9] mptcp: fix error mibs accounting Mat Martineau
2022-06-28 1:02 ` [PATCH net 2/9] mptcp: introduce MAPPING_BAD_CSUM Mat Martineau
2022-06-28 1:02 ` [PATCH net 3/9] mptcp: invoke MP_FAIL response when needed Mat Martineau
2022-06-28 1:02 ` [PATCH net 4/9] mptcp: fix shutdown vs fallback race Mat Martineau
2022-06-28 1:02 ` [PATCH net 5/9] mptcp: consistent map handling on failure Mat Martineau
2022-06-28 1:02 ` [PATCH net 6/9] mptcp: fix race on unaccepted mptcp sockets Mat Martineau
2022-06-28 1:02 ` [PATCH net 7/9] selftests: mptcp: more stable diag tests Mat Martineau
2022-06-28 1:02 ` [PATCH net 8/9] mptcp: fix conflict with <netinet/in.h> Mat Martineau
2022-06-28 1:02 ` Mat Martineau [this message]
2022-06-29 4:00 ` [PATCH net 0/9] mptcp: Fixes for 5.19 patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220628010243.166605-10-mathew.j.martineau@linux.intel.com \
--to=mathew.j.martineau@linux.intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=geliang.tang@suse.com \
--cc=kuba@kernel.org \
--cc=matthieu.baerts@tessares.net \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).