From: Matthieu Baerts <matttbe@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>,
Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>
Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, Shuah Khan <shuah@kernel.org>,
Mat Martineau <martineau@kernel.org>,
Geliang Tang <geliang@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>
Subject: Re: [PATCH] selftests: mptcp: initialize raw_addr to Null
Date: Fri, 28 Nov 2025 11:34:38 +0100 [thread overview]
Message-ID: <603f6c4f-20a1-4b6b-80a8-c9d9d3373d7e@kernel.org> (raw)
In-Reply-To: <20251127170041.0613c50e@kernel.org>
Hi Jakub, Ankit,
On 28/11/2025 02:00, Jakub Kicinski wrote:
> On Wed, 26 Nov 2025 17:55:14 +0100 Matthieu Baerts wrote:
>> 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:
>
> I think annotating xerror with __noreturn is a better fix.
Good idea, I didn't know about that!
Thank you for the review!
> Including kselftest.h will be needed.
Because mptcp_connect.c is a tool that is used by other selftests, but
it doesn't interact directly with the selftests, maybe we don't need to
include it, and only add this #define in mptcp_connect.c?
#define __noreturn __attribute__((__noreturn__))
(I don't know if a #ifndef/#endif is needed.)
That's a detail, I guess either is fine and shouldn't cause other issues.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2025-11-28 10:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 16:30 Ankit Khushwaha
2025-11-26 16:55 ` Matthieu Baerts
2025-11-28 1:00 ` Jakub Kicinski
2025-11-28 10:34 ` Matthieu Baerts [this message]
2025-11-28 18:40 ` Jakub Kicinski
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=603f6c4f-20a1-4b6b-80a8-c9d9d3373d7e@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=justinstitt@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=martineau@kernel.org \
--cc=morbo@google.com \
--cc=mptcp@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--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
all inboxes | Powered by JetHome®