[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <632d57cf-becd-4d09-bb21-0e3db6776c49@kernel.org>
Date: Sat, 29 Nov 2025 19:13:08 +0100
From: Matthieu Baerts <matttbe@...nel.org>
To: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>,
Mat Martineau <martineau@...nel.org>, Geliang Tang <geliang@...nel.org>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>
Cc: Shuah Khan <shuah@...nel.org>, netdev@...r.kernel.org,
mptcp@...ts.linux.dev, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2] selftests: mptcp: Mark xerror __noreturn
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@...il.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.
Powered by blists - more mailing lists