[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240730204529.GG5334@ZenIV>
Date: Tue, 30 Jul 2024 21:45:29 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Olaf Hering <olaf@...fle.de>
Cc: Deepa Dinamani <deepa.kernel@...il.com>,
Jeff Layton <jlayton@...nel.org>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>
Subject: Re: [PATCH v1] mount: handle OOM on mnt_warn_timestamp_expiry
On Tue, Jul 30, 2024 at 09:58:27PM +0200, Olaf Hering wrote:
> Tue, 30 Jul 2024 16:49:24 +0100 Al Viro <viro@...iv.linux.org.uk>:
>
> > d_path() is *NOT* going to return NULL.
>
> The existing documentation does not state that fact.
Needs to be fixed, but as a general rule - mixing NULL and ERR_PTR()
for error reporting is a Very Bad Idea(tm). There are cases when
there's a legitimate reason for a function to return both, but they
are rare and NULL should not be an error case. Example: d_splice_alias();
ERR_PTR(-E...) => error; NULL => success, passed candidate had been
accepted and attached to inode; pointer to struct dentry instance
=> success, preexisting alias returned and should be used instead
of the candidate.
Using IS_ERR_OR_NULL for "future-proofing" is obfuscating the things
for no good reason - it confuses the readers, and it tends to spread
when people are copying the code around.
Please, don't do it.
Powered by blists - more mailing lists