Re: Clarifying confusion of our variable placement rules caused by cleanup.h

From: Al Viro

Date: Tue Nov 18 2025 - 15:43:16 EST


On Tue, Nov 18, 2025 at 11:14:21AM -0800, Linus Torvalds wrote:

> It's not exactly uncommon to have code like this:
>
> struct xyz *abc = kzalloc(sizeof(struct xyz), GPF_KERNEL);
>
> and I don't think there's any actual *value* in stating that "struct
> xyz" twice (or in stating the sizeof()).

Depends... "Need to find all places where we have struct xyz instances
allocated" does happen on code audit; making it harder to find...

Pet peeve: I really wish we had a decent way to say that pointers to
this particular type are _not_ to be converted without an explicit
(and searchable) cast... Tricks like wrapping pointer into a struct
do work to an extent, but not when you need to dereference it in a lot
of places ;-/