[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <795a8f3c-eff7-46d9-9175-a4ebe3f9ffd8@kernel.org>
Date: Wed, 26 Nov 2025 17:55:14 +0100
From: Matthieu Baerts <matttbe@...nel.org>
To: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
Cc: netdev@...r.kernel.org, mptcp@...ts.linux.dev,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, Shuah Khan <shuah@...nel.org>,
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>, Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>
Subject: Re: [PATCH] selftests: mptcp: initialize raw_addr to Null
Hi Ankit,
On 26/11/2025 17:30, Ankit Khushwaha wrote:
> The "void *raw_addr" is left uninitialized when else path is
> followed raising below warning.
>
> mptcp_connect.c:1262:11: warning: variable 'raw_addr' is used
> uninitialized whenever 'if' condition is false
> [-Wsometimes-uninitialized]
>
> so the fix is to assign *raw_addr to NULL to suppress the warning.
Thank you for having shared this patch!
> Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
> ---
> compiler used: clang version 21.1.5 (Fedora 21.1.5-1.fc43).
> compilation cmd used:
> make -C tools/testing/selftests/net/mptcp CC=clang V=1 -j8
>
> this maybe also be false positive. But somehow clang - 21.1.5
> triggering this.
I confirm this, I can reproduce the warning with Clang 21.
It is indeed a false positive, because the code does that:
if (addr.ss_family == AF_INET)
raw_addr = &(((struct sockaddr_in *)&addr)->sin_addr);
else if (addr.ss_family == AF_INET6)
raw_addr = &(((struct sockaddr_in6 *)&addr)->sin6_addr);
else
xerror("bad family");
"xerror()" calls "exit(1)", so "raw_addr" is never used uninitialized.
I'm not sure why Clang 21 reports that now, and not before, but well,
the modification you did in the selftests doesn't hurt:
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@...nel.org>
@Net maintainers: this patch can be applied in 'net' directly.
@Antik: next time, please specify the target (net/net-next) in the
subject, see [1]. No need to send a new version (except if the Net
maintainers prefer), this patch can be applied on top of "net" without
conflicts.
[1] https://docs.kernel.org/process/maintainer-netdev.html
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
Powered by blists - more mailing lists