Re: kcsan -Wmaybe-uninitialized warning in ntfs3
From: Marco Elver
Date: Fri Apr 24 2026 - 06:08:45 EST
On Thu, 23 Apr 2026 at 15:06, David Laight <david.laight.linux@xxxxxxxxx> wrote:
>
> On Thu, 23 Apr 2026 13:35:09 +0200
> Marco Elver <elver@xxxxxxxxxx> wrote:
>
> > On Thu, 23 Apr 2026 at 10:12, David Laight <david.laight.linux@xxxxxxxxx> wrote:
> > > On Wed, 22 Apr 2026 23:50:22 +0200
> > > Marco Elver <elver@xxxxxxxxxx> wrote:
> > >
> > > > Which means the simplest fix is probably the absolute_pointer() one.
> > >
> > > I'm not sure that using absolute_pointer() is right, it is normally used
> > > for special conversions in low level boot code.
> > >
> > > Here it might just be best to explicitly use (void *)(long)addr.
> >
> > That didn't work - tried, and warnings still there (GCC seems to see
> > through it).
>
> The only difference is the extra local - unless the '+ 0' matters.
>
> OPTIMIZE_HIDE_VAR() should work, but is annoying to use in a function call.
> You sort of need:
> #define OPTIMIZER_HIDE_VAL(x) {( \
> auto _x = x; \
> asm ("", "+r" (_x)); \
> _x; \
> )}
>
> (also useful for 'lying' to snprintf())
Isn't that effectively what RELOC_HIDE (and absolute_pointer) is
supposed to do? I don't see the need to add another similar macro, we
already have too many horrible macros like this. And in this case it's
not necessarily the optimizer we're trying to hide this wrong, but
from the semantic analyzer that gives us these false positive
diagnostics.