linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Christopher Lameter <cl@linux.com>
Cc: William Kucharski <william.kucharski@oracle.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm: ksize() should silently accept a NULL pointer
Date: Wed, 17 Jun 2020 09:26:43 -0700	[thread overview]
Message-ID: <20200617162643.GK8681@bombadil.infradead.org> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2006171621140.1574@www.lameter.com>

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?


      reply	other threads:[~2020-06-17 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 22:54 [PATCH] mm: ksize() should silently accept a NULL pointer William Kucharski
2020-06-17  0:45 ` Matthew Wilcox
2020-06-17  7:09 ` David Hildenbrand
2020-06-17 16:23 ` Christopher Lameter
2020-06-17 16:26   ` Matthew Wilcox [this message]

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=20200617162643.GK8681@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=william.kucharski@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).