From: Al Viro <viro@zeniv.linux.org.uk>
To: "Miquel Sabaté Solà" <mssola@mssola.com>
Cc: linux-fsdevel@vger.kernel.org, brauner@kernel.org,
linux-kernel@vger.kernel.org, jack@suse.cz
Subject: Re: [PATCH] fs: Use a cleanup attribute in copy_fdtable()
Date: Sat, 4 Oct 2025 22:19:08 +0100 [thread overview]
Message-ID: <20251004211908.GD2441659@ZenIV> (raw)
In-Reply-To: <20251004210340.193748-1-mssola@mssola.com>
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@zeniv.linux.org.uk>
next prev parent reply other threads:[~2025-10-04 21:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-04 21:03 [PATCH] fs: Use a cleanup attribute in copy_fdtable() Miquel Sabaté Solà
2025-10-04 21:19 ` Al Viro [this message]
2025-10-05 5:37 ` Miquel Sabaté Solà
2025-10-05 9:01 ` Al Viro
2025-10-05 17:41 ` Miquel Sabaté Solà
2025-10-05 21:30 ` Al Viro
2025-10-06 7:55 ` Miquel Sabaté Solà
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251004211908.GD2441659@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mssola@mssola.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.