Skip to content

Commit

Permalink
slab, kmemleak: stop calling kmemleak_erase() unconditionally
Browse files Browse the repository at this point in the history
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 <catalin.marinas@arm.com>
Signed-off-by: J. R. Okajima <hooanon05@yahoo.co.jp>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
  • Loading branch information
J. R. Okajima authored and Pekka Enberg committed Dec 6, 2009
1 parent 648f4e3 commit f3d8b53
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit f3d8b53

Please sign in to comment.