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.