linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Hugh Dickins <hugh@veritas.com>
Cc: nickpiggin@yahoo.com.au, penberg@cs.helsinki.fi, mpm@selenic.com,
	kosaki.motohiro@jp.fujitsu.com, david.vrabel@csr.com,
	hannes@cmpxchg.org, chas@cmf.nrl.navy.mil, johnpol@2ka.mipt.ru,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	cl@linux-foundation.org, npiggin@suse.de
Subject: Re: [patch 1/7] slab: introduce kzfree()
Date: Mon, 23 Feb 2009 11:42:00 -0800	[thread overview]
Message-ID: <20090223114200.3d14cc3b.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0902231429360.28573@blonde.anvils>

On Mon, 23 Feb 2009 14:51:05 +0000 (GMT)
Hugh Dickins <hugh@veritas.com> wrote:

> On Tue, 24 Feb 2009, Nick Piggin wrote:
> > 
> > Well, the buffer is only non-modified in the case of one of the
> > allocators (SLAB). All others overwrite some of the data region
> > with their own metadata.
> > 
> > I think it is OK to use const, though. Because k(z)free has the
> > knowledge that the data will not be touched by the caller any
> > longer.
> 
> Sorry, you're not adding anything new to the thread here.
> 
> Yes, the caller is surrendering the buffer, so we can get
> away with calling the argument const; and Linus argues that's
> helpful in the case of kfree (to allow passing a const pointer
> without having to cast it).
> 
> My contention is that kzfree(const void *ptr) is nonsensical
> because it says please zero this buffer without modifying it.

yup.  The intent of kzfree() is explicitly, overtly, deliberately to
modify the passed memory before freeing it.  Marking it const is dopey.

But the const marker is potentially useful to some caller.  An arguably
misdesigned caller.

> But the change has gone in, I seem to be the only one still
> bothered by it, and I've conceded that the "z" might stand
> for zap rather than zero.

Yeah.  But it's a very small bother.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2009-02-23 19:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-17 18:26 [patch 0/7] kzfree() v2 Johannes Weiner
2009-02-17 18:26 ` [patch 1/7] slab: introduce kzfree() Johannes Weiner
2009-02-17 20:06   ` Christoph Lameter
2009-02-18 10:50   ` David Vrabel
2009-02-18 10:54     ` Pekka Enberg
2009-02-19  1:22       ` KOSAKI Motohiro
2009-02-19  9:13         ` Pekka Enberg
2009-02-19 12:12           ` KOSAKI Motohiro
2009-02-19 16:34           ` Hugh Dickins
2009-02-19 18:02             ` Matt Mackall
2009-02-19 18:28               ` Hugh Dickins
2009-02-19 19:45                 ` Pekka Enberg
2009-02-19 20:36                   ` Hugh Dickins
2009-02-23 14:01                     ` Nick Piggin
2009-02-23 14:51                       ` Hugh Dickins
2009-02-23 15:07                         ` Nick Piggin
2009-02-23 19:42                         ` Andrew Morton [this message]
2009-02-19 19:48                 ` Johannes Weiner
2009-02-17 18:26 ` [patch 2/7] crypto: use kzfree() Johannes Weiner
2009-02-20  4:53   ` Herbert Xu
2009-02-17 18:26 ` [patch 3/7] s390: " Johannes Weiner
2009-02-17 18:26 ` [patch 4/7] md: " Johannes Weiner
2009-02-17 18:26 ` [patch 5/7] usb: " Johannes Weiner
2009-02-18 10:51   ` David Vrabel
2009-02-17 18:26 ` [patch 6/7] cifs: " Johannes Weiner
2009-02-17 18:26 ` [patch 7/7] ecryptfs: " Johannes Weiner

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=20090223114200.3d14cc3b.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=chas@cmf.nrl.navy.mil \
    --cc=cl@linux-foundation.org \
    --cc=david.vrabel@csr.com \
    --cc=hannes@cmpxchg.org \
    --cc=hugh@veritas.com \
    --cc=johnpol@2ka.mipt.ru \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    --cc=nickpiggin@yahoo.com.au \
    --cc=npiggin@suse.de \
    --cc=penberg@cs.helsinki.fi \
    /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