Re: kcsan -Wmaybe-uninitialized warning in ntfs3
Marco Elver <[email protected]> Wed, 22 Apr 2026 13:51:20 +0200
| Newsgroups | dev.linux.lists.ntfs3,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Apr 22, 2026 at 01:35PM +0200, Marco Elver wrote: > On Wed, 22 Apr 2026 at 10:23, Marco Elver <[email protected]> wrote: > > > > On Wed, 22 Apr 2026 at 10:00, Arnd Bergmann <[email protected]> wrote: > > > > > > On Tue, Apr 21, 2026, at 21:12, Arnd Bergmann wrote: > > > > On Tue, Apr 21, 2026, at 21:06, Marco Elver wrote: > > > >> On Tue, 21 Apr 2026 at 17:26, Marco Elver <[email protected]> wrote: > > > >> [...] > > > >>> > To me, 2 makes more sense. The attribute requires gcc-11 or higher, > > > >>> > so you need to wrap that in a compiler version specific macro, > > > >>> > but since I only saw the warning with gcc-12 and higher, that > > > >>> > should be fine. > > > >> > > > >> Kindly test if you can: > > > >> https://lore.kernel.org/all/[email protected]/ > > > > > > > > Applied to my randconfig tree and verified that this fixes the > > > > known warning (only one out of about 200 random configs). I'll > > > > let you know if something comes up by tomorrow. > > > > > > Unfortunately, there are new warnings after your patches using > > > gcc-11. In 500 randconfig builds with that compiler, I saw 7 > > > configurations failing with one of these four messages: > > > > Looks like a compiler bug to me; can you check gcc-12+ ? Maybe we need > > to allow the __access attribute only for later GCC versions. > > I can also see this warning with later GCC - so I'll give up on the > __attribute__((access)) version and instead suppress warnings. The simplest solution I found so far: diff --git a/include/linux/kcsan-checks.h b/include/linux/kcsan-checks.h index 92f3843d9ebb..989fd21841ba 100644 --- a/include/linux/kcsan-checks.h +++ b/include/linux/kcsan-checks.h @@ -282,7 +282,7 @@ static inline void __kcsan_disable_current(void) { } * @size: size of access */ #define __kcsan_check_write(ptr, size) \ - __kcsan_check_access(ptr, size, KCSAN_ACCESS_WRITE) + __kcsan_check_access(absolute_pointer(ptr), size, KCSAN_ACCESS_WRITE) /** * __kcsan_check_read_write - check regular read-write access for races @@ -291,7 +291,7 @@ static inline void __kcsan_disable_current(void) { } * @size: size of access */ #define __kcsan_check_read_write(ptr, size) \ - __kcsan_check_access(ptr, size, KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE) + __kcsan_check_access(absolute_pointer(ptr), size, KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE) /** * kcsan_check_read - check regular read access for races @@ -308,7 +308,7 @@ static inline void __kcsan_disable_current(void) { } * @size: size of access */ #define kcsan_check_write(ptr, size) \ - kcsan_check_access(ptr, size, KCSAN_ACCESS_WRITE) + kcsan_check_access(absolute_pointer(ptr), size, KCSAN_ACCESS_WRITE) /** * kcsan_check_read_write - check regular read-write access for races @@ -317,7 +317,7 @@ static inline void __kcsan_disable_current(void) { } * @size: size of access */ #define kcsan_check_read_write(ptr, size) \ - kcsan_check_access(ptr, size, KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE) + kcsan_check_access(absolute_pointer(ptr), size, KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE) /* * Check for atomic accesses: if atomic accesses are not ignored, this simply @@ -331,9 +331,9 @@ static inline void __kcsan_disable_current(void) { } #define kcsan_check_atomic_read(ptr, size) \ kcsan_check_access(ptr, size, KCSAN_ACCESS_ATOMIC) #define kcsan_check_atomic_write(ptr, size) \ - kcsan_check_access(ptr, size, KCSAN_ACCESS_ATOMIC | KCSAN_ACCESS_WRITE) + kcsan_check_access(absolute_pointer(ptr), size, KCSAN_ACCESS_ATOMIC | KCSAN_ACCESS_WRITE) #define kcsan_check_atomic_read_write(ptr, size) \ - kcsan_check_access(ptr, size, KCSAN_ACCESS_ATOMIC | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_COMPOUND) + kcsan_check_access(absolute_pointer(ptr), size, KCSAN_ACCESS_ATOMIC | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_COMPOUND) #endif /**