Re: [PATCH v3 3/3] mm: kmemleak: Use the memory pool for early allocations

From: Catalin Marinas
Date: Tue Aug 13 2019 - 05:35:17 EST


On Mon, Aug 12, 2019 at 05:06:42PM +0100, Catalin Marinas wrote:
> @@ -466,9 +419,13 @@ static struct kmemleak_object *mem_pool_alloc(gfp_t gfp)
> struct kmemleak_object *object;
>
> /* try the slab allocator first */
> - object = kmem_cache_alloc(object_cache, gfp_kmemleak_mask(gfp));
> - if (object)
> - return object;
> + if (object_cache) {
> + object = kmem_cache_alloc(object_cache, gfp_kmemleak_mask(gfp));
> + if (object)
> + return object;
> + else
> + WARN_ON_ONCE(1);

Oops, this was actually my debug warning just to make sure it triggered
(tested with failslab). The WARN_ON_ONCE(1) should be removed (I changed
it locally in case I post an update).

I noticed it in Andrew's subsequent checkpatch fix.

--
Catalin