[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 3 Mar 2010 22:54:02 +0100
From: Pavel Machek <pavel@....cz>
To: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc: cl@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH] mm: Remove ZERO_SIZE_PTR.
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists