Re: [PATCH RESEND v3] checkpatch: add uninitialized pointer with __free attribute check

From: Markus Elfring

Date: Wed Nov 05 2025 - 04:19:38 EST



> > +++ b/Documentation/dev-tools/checkpatch.rst
> > @@ -1009,6 +1009,11 @@ Functions and Variables
> >
> > return bar;
> >
> > + **UNINITIALIZED_PTR_WITH_FREE**
> > + Pointers with __free attribute should be initialized. Not doing so
> > + may lead to undefined behavior as the memory allocated (garbage,
> > + in case not initialized) to the pointer is freed automatically
> > + when the pointer goes out of scope.
>
> I think this is misleading, and can be improved: if the pointer is
> uninitialized, no memory was allocated?

* Do corresponding source code analysis requirements indicate a need
to perform data processing with other programming interfaces than regular expressions?

* How do you think about to mention the possibility once more that scopes
can be reduced for affected local variables?
https://elixir.bootlin.com/linux/v6.18-rc4/source/include/linux/cleanup.h#L142-L146


Regards,
Markus