[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZFkf/oJnCLZSWgYr@mit.edu>
Date: Mon, 8 May 2023 12:14:54 -0400
From: "Theodore Ts'o" <tytso@....edu>
To: Tudor Ambarus <tudor.ambarus@...aro.org>
Cc: adilger.kernel@...ger.ca, linux-ext4@...r.kernel.org,
linux-kernel@...r.kernel.org, joneslee@...gle.com,
linux-mm@...ck.org
Subject: Re: [PATCH] ext4: remove superfluous check that pointer is not NULL
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@...aro.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
Powered by blists - more mailing lists