Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754155AbZLBJyY (ORCPT ); Wed, 2 Dec 2009 04:54:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751397AbZLBJyX (ORCPT ); Wed, 2 Dec 2009 04:54:23 -0500 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:48580 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751366AbZLBJyX (ORCPT ); Wed, 2 Dec 2009 04:54:23 -0500 To: "J. R. Okajima" Cc: linux-kernel@vger.kernel.org, penberg@cs.helsinki.fi 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> From: Catalin Marinas Date: Wed, 02 Dec 2009 09:54:25 +0000 In-Reply-To: <1259740550-10394-2-git-send-email-hooanon05@yahoo.co.jp> (J. R. Okajima's message of "Wed\, 2 Dec 2009 16\:55\:49 +0900") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-OriginalArrivalTime: 02 Dec 2009 09:54:27.0204 (UTC) FILETIME=[6F58EC40:01CA7335] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1132 Lines: 34 "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 -- Catalin -- 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/