mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: cl@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH] mm: Remove ZERO_SIZE_PTR.
Date: Wed, 3 Mar 2010 22:54:02 +0100	[thread overview]
Message-ID: <20100303215402.GE2579@ucw.cz> (raw)
In-Reply-To: <201002270959.EEI05786.OOFFQVMFJLOtSH@I-love.SAKURA.ne.jp>

Hi!

> > > Everybody should check for ptr != NULL, and most callers are actually checking
> > > for ptr != NULL. But nobody is checking for ptr != ZERO_SIZE_PTR.
> > 
> > That is so intentionally because some kernel subsystem can do a zero size
> > allocation.
> > 
> So, not only users *can* do zero size allocation,
> but also there *are* users who are intentionally doing zero size allocation.
> Then, we can't remove ZERO_SIZE_PTR.
> 
> > > Yes, this is the fault of caller. But ZERO_SIZE_PTR is too small value to
> > > distinguish "NULL pointer dereference" and "ZERO_SIZE_PTR dereference" because
> > > address printed by oops message can easily exceed ZERO_SIZE_PTR when
> > > "struct foo" is large.
> > 
> > Correct.
> 
> Maybe PAGE_SIZE / 2 is better than 16?

Actually maybe 1 is better than 16?

It is 'nicer' number, and <= ZERO_SIZE_PTR will actually be correct.

Accessing field it struct will also be easy to differentiate from NULL
pointer -- as most members are word aligned...

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

      reply	other threads:[~2010-03-03 21:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-26  6:35 Tetsuo Handa
2010-02-26  6:59 ` KOSAKI Motohiro
2010-02-26  8:38   ` Tetsuo Handa
2010-02-26  8:44     ` KOSAKI Motohiro
2010-02-26 18:23     ` David Wagner
2010-02-26  7:26 ` David Wagner
2010-02-26 16:39 ` Christoph Lameter
2010-02-27  0:59   ` Tetsuo Handa
2010-03-03 21:54     ` Pavel Machek [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=20100303215402.GE2579@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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

all inboxes | Powered by JetHome®