Re: [PATCH 6.1 000/167] 6.1.136-rc1 review

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 30, 2025 at 12:58:13PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Apr 30, 2025 at 04:09:18PM +0530, Naresh Kamboju wrote:
> > Regressions on x86_64 with defconfig builds with clang-nightly toolchain
> > on the stable-rc 6.1.136-rc1.

clang-nightly is always a moving target so for the sake of the stable
-rc reports, I would only focus on issues that appear with just those
patches, as you should see this issue on 6.1.136.

> > * x86_64, build
> >   - clang-nightly-lkftconfig
> >   - clang-nightly-x86_64_defconfig
> > 
> > Regression Analysis:
> >  - New regression? Yes
> >  - Reproducibility? Yes
> > 
> > Build regression: x86_64 clang-nightly net ip.h error default
> > initialization of an object of type 'typeof (rt->dst.expires)'
> > 
> > Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
> > 
> > ## Build error x86_64
> > include/net/ip.h:462:14: error: default initialization of an object of
> > type 'typeof (rt->dst.expires)' (aka 'const unsigned long') leaves the
> > object uninitialized and is incompatible with C++
> > [-Werror,-Wdefault-const-init-unsafe]
> >   462 |                 if (mtu && time_before(jiffies, rt->dst.expires))
> >       |                            ^
> 
> This isn't c++, so are you sure this isn't just a clang bug?

Yes, it is intentional that this warns for C code, the clang maintainer
felt that the default initialization behavior of const variables not
marked as static or thread local was worth warning about by default.

https://github.com/llvm/llvm-project/pull/137166

But it is going to be adjusted to allow the kernel to opt-out of the
warning for aggregate members, as that triggers often in the kernel:

https://github.com/llvm/llvm-project/pull/137961

The only instance of -Wdefault-const-init-var-unsafe that I have found
so far is in typecheck(), which should be easy enough to clean up.

Cheers,
Nathan

diff --git a/include/linux/typecheck.h b/include/linux/typecheck.h
index 46b15e2aaefb..5b473c9905ae 100644
--- a/include/linux/typecheck.h
+++ b/include/linux/typecheck.h
@@ -7,8 +7,8 @@
  * Always evaluates to 1 so you may use it easily in comparisons.
  */
 #define typecheck(type,x) \
-({	type __dummy; \
-	typeof(x) __dummy2; \
+({	type __dummy = {}; \
+	typeof(x) __dummy2 = {}; \
 	(void)(&__dummy == &__dummy2); \
 	1; \
 })




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux