Re: [PATCH v4 3/4] cleanup: Annotate guard constructors with __nonnull()

From: Dmitry Ilvokhin

Date: Sat May 23 2026 - 09:54:35 EST


On Sat, May 23, 2026 at 10:49:01AM +0200, Peter Zijlstra wrote:
> On Thu, May 21, 2026 at 07:18:03AM +0000, Dmitry Ilvokhin wrote:
> > Add __nonnull() to unconditional guard constructors so the compiler
> > warns when NULL is statically known to be passed:
> >
> > - DEFINE_GUARD(): re-declare the constructor with __nonnull().
> > - __DEFINE_LOCK_GUARD_1(): annotate the constructor directly.
> >
> > DEFINE_LOCK_GUARD_0() needs no annotation: its constructor takes no
> > pointer arguments (.lock is hardcoded to (void *)1).
> >
> > Define the __nonnull() macro in compiler_attributes.h, following the
> > existing convention for attribute wrappers.
> >
> > Signed-off-by: Dmitry Ilvokhin <d@xxxxxxxxxxxx>
> > Acked-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
>
> The build robot found something to hate in this one. I think you're on
> Cc there. It looks to me like clang-23 is confused somehow, but who
> knows.

Thanks for the heads-up, Peter. I got the report and will look into it.