[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <603f6c4f-20a1-4b6b-80a8-c9d9d3373d7e@kernel.org>
Date: Fri, 28 Nov 2025 11:34:38 +0100
From: Matthieu Baerts <matttbe@...nel.org>
To: Jakub Kicinski <kuba@...nel.org>,
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>,
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 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.
Powered by blists - more mailing lists