From: "Theodore Ts'o" <tytso@mit.edu>
To: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org,
linux-kernel@vger.kernel.org, joneslee@google.com,
linux-mm@kvack.org
Subject: Re: [PATCH] ext4: remove superfluous check that pointer is not NULL
Date: Mon, 8 May 2023 12:14:54 -0400 [thread overview]
Message-ID: <ZFkf/oJnCLZSWgYr@mit.edu> (raw)
In-Reply-To: <20230508151337.79304-1-tudor.ambarus@linaro.org>
On Mon, May 08, 2023 at 03:13:37PM +0000, Tudor Ambarus wrote:
> If @buffer is NULL, no operation is performed for kvfree(buffer),
> remove superfluous check.
>
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
I was looking at this just a few weeks ago, and I couldn't find any
actual *documentation* that it was safe to call vfree(NIILL) or
kvfree(NULL). The problem is there are a lot of architecture-specific
functions, and unlike with kfree() there is no top-level "if (ptr ==
NULL) return;" in the top-level vfree() and kvfree().
So I thought about removing the NULL check for kvfree(), and
ultimately chickened out, since I was afraid that there might be
crashes for some obscure architecture or kernel CONFIG setup.
I've added linux-mm@ for their comments, and for a plea that if it
is safe to pass NULL to vfree, kvfree, kvfree_rcu, etc. that it
actually be *documented* somewhere.
- Ted
next parent reply other threads:[~2023-05-08 16:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230508151337.79304-1-tudor.ambarus@linaro.org>
2023-05-08 16:14 ` Theodore Ts'o [this message]
2023-05-08 21:13 ` Matthew Wilcox
2023-05-09 18:53 ` Theodore Ts'o
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=ZFkf/oJnCLZSWgYr@mit.edu \
--to=tytso@mit.edu \
--cc=adilger.kernel@dilger.ca \
--cc=joneslee@google.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tudor.ambarus@linaro.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox