Messages in this thread | | | Date | Mon, 4 Jun 2007 15:44:24 +0100 | From | Alan Cox <> | 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |