Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754825AbZLFIdI (ORCPT ); Sun, 6 Dec 2009 03:33:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754329AbZLFIdE (ORCPT ); Sun, 6 Dec 2009 03:33:04 -0500 Received: from courier.cs.helsinki.fi ([128.214.9.1]:40927 "EHLO mail.cs.helsinki.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753634AbZLFIdD (ORCPT ); Sun, 6 Dec 2009 03:33:03 -0500 Message-ID: <4B1B6C3C.7060503@cs.helsinki.fi> Date: Sun, 06 Dec 2009 10:33:00 +0200 From: Pekka Enberg User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: Catalin Marinas CC: "J. R. Okajima" , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] slab, kmemleak, minor, stop calling kmemleak_erase() unconditionally References: <1259740550-10394-1-git-send-email-hooanon05@yahoo.co.jp> <1259740550-10394-2-git-send-email-hooanon05@yahoo.co.jp> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1189 Lines: 34 Catalin Marinas wrote: > "J. R. Okajima" wrote: >> 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. >> >> Signed-off-by: J. R. Okajima >> --- >> mm/slab.c | 3 ++- >> 1 files changed, 2 insertions(+), 1 deletions(-) >> >> 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; >> } > > Acked-by: Catalin Marinas Applied, thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/