Re: [PATCH] fs: Use a cleanup attribute in copy_fdtable()

From: Al Viro
Date: Sat Oct 04 2025 - 17:19:26 EST


On Sat, Oct 04, 2025 at 11:03:40PM +0200, Miquel Sabaté Solà wrote:
> This is a small cleanup in which by using the __free(kfree) cleanup
> attribute we can avoid three labels to go to, and the code turns to be
> more concise and easier to follow.

Have you tried to build and boot that?

That aside, it is not easier to follow in that form - especially since
kfree() is *not* the right destructor for the object in question.
Having part of destructor done via sodding __cleanup, with the rest
open-coded on various failure exits is confusing as hell.

RAII has its uses, but applied unidiomatically it ends up being a mess
that is harder to follow and reason about than the dreadful gotos it
replaces.

NAKed-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>