[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070604154424.5c4750f7@the-village.bc.nu>
Date: Mon, 4 Jun 2007 15:44:24 +0100
From: Alan Cox <alan@...rguk.ukuu.org.uk>
To: Matt Mackall <mpm@...enic.com>
Cc: Christoph Lameter <clameter@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
jeremy@...p.org
Subject: Re: SLUB: Return ZERO_SIZE_PTR for kmalloc(0)
> > > I agree the risk is low, but if something _does_ blow up, it will do so subtly.
>
> Arguable the proposed badptr behavior is correct. It's basically "how many
> angels can dance on the head of a pin"? All the returned pointers are
> at least 0 bytes away from the previous one.
C++ very carefully keeps objects of zero size at differing addresses to
avoid exactly this kind of pointer confusion. Given the trivial fix is
simply
size += !size;
at the start of malloc what is there worth arguing about ?
-
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