From: Matthieu Baerts <matttbe@kernel.org>
To: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>,
Mat Martineau <martineau@kernel.org>,
Geliang Tang <geliang@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>,
netdev@vger.kernel.org, mptcp@lists.linux.dev,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2] selftests: mptcp: Mark xerror __noreturn
Date: Sat, 29 Nov 2025 19:13:08 +0100 [thread overview]
Message-ID: <632d57cf-becd-4d09-bb21-0e3db6776c49@kernel.org> (raw)
In-Reply-To: <20251129043808.16714-1-ankitkhushwaha.linux@gmail.com>
Hi Ankit,
On 29/11/2025 05:38, Ankit Khushwaha wrote:
> Compiler reports potential uses of uninitialized variables in
> mptcp_connect.c when xerror() is called from failure paths.
>
> mptcp_connect.c:1262:11: warning: variable 'raw_addr' is used
> uninitialized whenever 'if' condition is false
> [-Wsometimes-uninitialized]
>
> xerror() terminates execution by calling exit(), but it is not visible
> to the compiler & assumes control flow may continue past the call.
>
> Annotate xerror() with __noreturn so the compiler can correctly reason
> about control flow and avoid false-positive uninitialized variable
> warnings.
>
> Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>
> ---
> changelog:
> v2:
> - annotate 'xerror()' with __noreturn
> - remove defining 'raw_addr' to NULL
Thank you for the new version!
Note: this patch can target 'net' instead of 'net-next'.
> ---
> tools/testing/selftests/net/mptcp/Makefile | 4 ++++
> tools/testing/selftests/net/mptcp/mptcp_connect.c | 3 ++-
> tools/testing/selftests/net/mptcp/mptcp_inq.c | 3 ++-
> tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 3 ++-
Good idea to fix the other tools too!
> 4 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile
> index 15d144a25d82..4c94c01b893a 100644
> --- a/tools/testing/selftests/net/mptcp/Makefile
> +++ b/tools/testing/selftests/net/mptcp/Makefile
> @@ -35,3 +35,7 @@ TEST_INCLUDES := ../lib.sh $(wildcard ../lib/sh/*.sh)
> EXTRA_CLEAN := *.pcap
>
> include ../../lib.mk
> +
> +$(OUTPUT)/mptcp_connect: CFLAGS += -I$(top_srcdir)/tools/include
> +$(OUTPUT)/mptcp_sockopt: CFLAGS += -I$(top_srcdir)/tools/include
> +$(OUTPUT)/mptcp_inq: CFLAGS += -I$(top_srcdir)/tools/include
Small detail: I think you can simply append the "main" CFLAGS at the top
of the file instead of adding specific rules per tool.
Note: because the CFLAGS variable is already long, please split it like
it is done in tools/testing/selftests/net/Makefile.
While at it, do you mind adding __noreturn to die_perror() in
mptcp_diag.c mptcp_inq.c mptcp_sockopt.c as well please?
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2025-11-29 18:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-29 4:38 [PATCH net-next v2] selftests: mptcp: Mark xerror __noreturn Ankit Khushwaha
2025-11-29 18:13 ` Matthieu Baerts [this message]
2025-11-30 1:41 ` Jakub Kicinski
2025-11-30 17:09 ` Matthieu Baerts
2025-12-01 4:07 ` Ankit Khushwaha
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=632d57cf-becd-4d09-bb21-0e3db6776c49@kernel.org \
--to=matttbe@kernel.org \
--cc=ankitkhushwaha.linux@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martineau@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/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).