[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200617162643.GK8681@bombadil.infradead.org>
Date: Wed, 17 Jun 2020 09:26:43 -0700
From: Matthew Wilcox <willy@...radead.org>
To: Christopher Lameter <cl@...ux.com>
Cc: William Kucharski <william.kucharski@...cle.com>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] mm: ksize() should silently accept a NULL pointer
On Wed, Jun 17, 2020 at 04:23:04PM +0000, Christopher Lameter wrote:
> On Tue, 16 Jun 2020, William Kucharski wrote:
>
> > Other mm routines such as kfree() and kzfree() silently do the right
> > thing if passed a NULL pointer, so ksize() should do the same.
>
> Ok so the size of an no object pointer is zero? Ignoring the freeing
> of a nonexisting object makes sense. But determining it size?
ksize() is misnamed. It's not the size of the object, it's the number
of bytes allocated for that object.
A NULL pointer represents a freed object, or one that was never
allocated in the first place. Clearly that's 0 bytes. What other
answer would make sense?
Powered by blists - more mailing lists