• Jesper Dangaard Brouer's avatar
    mm: kmemcheck skip object if slab allocation failed · 0142eae3
    Jesper Dangaard Brouer authored
    In the SLAB allocator kmemcheck_slab_alloc() is guarded against being
    called in case the object is NULL.  In SLUB allocator this NULL pointer
    invocation can happen, which seems like an oversight.
    
    Move the NULL pointer check into kmemcheck code (kmemcheck_slab_alloc)
    so the check gets moved out of the fastpath, when not compiled with
    CONFIG_KMEMCHECK.
    
    This is a step towards sharing post_alloc_hook between SLUB and SLAB,
    because slab_post_alloc_hook() does not perform this check before
    calling kmemcheck_slab_alloc().
    Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    0142eae3
kmemcheck.c 2.93 KB