lkml.org 
[lkml]   [2007]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: 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/

    \
     
     \ /
      Last update: 2007-06-04 16:45    [W:3.951 / U:0.396 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site