• Toke Høiland-Jørgensen's avatar
    lib/slab: introduce sl_allocz() function and use it in Babel · db2d2907
    Toke Høiland-Jørgensen authored and Ondřej Zajíček's avatar Ondřej Zajíček committed
    The babel protocol code was initialising objects returned from the slab
    allocator by assigning to each of the struct members individually, but
    wasn't touching the NODE member while doing so. This leads to warnings on
    debug builds since commit:
    
    baac7009 ("List expensive check.")
    
    To fix this, introduce an sl_allocz() variant of the slab allocator which
    will zero out the memory before returning it, and switch all the babel call
    sites to use this version. The overhead for doing this should be negligible
    for small objects, and in the case of babel, the largest object being
    allocated was being zeroed anyway, so we can drop the memset in
    babel_read_tlv().
    db2d2907