From: J. R. Okajima Date: Wed, 2 Dec 2009 07:55:49 +0000 (+0900) Subject: slab, kmemleak: stop calling kmemleak_erase() unconditionally X-Git-Tag: v2.6.33-rc1~297^2^3~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3d8b53a3abbfd0b74fa5dfaa690870d9619fad9;p=profile%2Fivi%2Fkernel-x86-ivi.git slab, kmemleak: stop calling kmemleak_erase() unconditionally When the gotten object is NULL (probably due to ENOMEM), kmemleak_erase() is unnecessary here, It just sets NULL to where already is NULL. Add a condition. Acked-by: Catalin Marinas Signed-off-by: J. R. Okajima Signed-off-by: Pekka Enberg --- diff --git a/mm/slab.c b/mm/slab.c index 7dfa481..4e61449 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3109,7 +3109,8 @@ static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags) * per-CPU caches is leaked, we need to make sure kmemleak doesn't * treat the array pointers as a reference to the object. */ - kmemleak_erase(&ac->entry[ac->avail]); + if (objp) + kmemleak_erase(&ac->entry[ac->avail]); return objp; }