Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp266939imp; Thu, 21 Feb 2019 00:46:10 -0800 (PST) X-Google-Smtp-Source: AHgI3IZiBVC+3lGbOKOppqxrvagVF46nMWRr95LmdMHEUuGESfCTJD8tf/EOfwrUMFVolT0GwXbm X-Received: by 2002:a63:e553:: with SMTP id z19mr33311555pgj.331.1550738770900; Thu, 21 Feb 2019 00:46:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550738770; cv=none; d=google.com; s=arc-20160816; b=Q7tYhKs6Mf5DPnMsgyOfej+p1amI6RhuIc72celsPGmwnVM8tHJlEvv02Gkr2B9CUO w2E4LosoORFwTVIhjUiZ3PgF/fXHZWtTo+RR6S0SoynSQNt8aE+1ZuzFz3LdT8J4LRmm KGVG97/BwOkxkBTkpMzMiwLpMAbNYsekrMVkydU5aeKt6VcHQwxkYtc/khDZtNStSSQz Esx5vxd8cAQ1RIYop+IqzzW7KFWlwPdkGB1Mia8rftLQ1pJ+SFItglruad2KfmS6ujR3 JWbSp3j2onlrinafzRGaK1YYgh8XrU9ahgYmp2pcQr9CBcc0is24mhaESy332vDXZM8F PYng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=YP5Jxr9TuNyxzhFCOOU+GwYUse1p0y0TNHGENlqYo3E=; b=kpGXRDr0ScpKIcI0m76PGmDxQfN+nhIc1ILUJlxDFXdXJufsX7x5Q0ATtMpXE55Xhw 02uVblz5PWzfemC21FFuFTV5Re6Ox0V8fhNL/d38Rj89HZI9Sc55eSZ+J2Rhib0tpmrN iwSFQtXxTtikAWNZYcqUdCT0VdGiVjbKNKblmMoqJBZURGlZBkjiTT+Kjev5hGCioAeE RnJGl0DLJUtwODTa32Vjnc4uDEPuUZbIhRgK2ZWZp3kpiIS0dM75g7QqhwYZPj+sYZgM Lb1gyaEcoScQ7mzKFAAuuxmculEm5GkLYmE7tVdAr7ECe3RFW7VYt5tppjrMdlV8Y4w+ EPYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1si20252249pgb.192.2019.02.21.00.45.55; Thu, 21 Feb 2019 00:46:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727473AbfBUIp2 (ORCPT + 99 others); Thu, 21 Feb 2019 03:45:28 -0500 Received: from mx2.suse.de ([195.135.220.15]:45024 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726354AbfBUIp1 (ORCPT ); Thu, 21 Feb 2019 03:45:27 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 77B87AEE8; Thu, 21 Feb 2019 08:45:26 +0000 (UTC) Date: Thu, 21 Feb 2019 09:45:25 +0100 From: Michal Hocko To: Greg KH Cc: Yue Hu , akpm@linux-foundation.org, rientjes@google.com, joe@perches.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, huyue2@yulong.com Subject: Re: [PATCH] mm/cma_debug: Check for null tmp in cma_debugfs_add_one() Message-ID: <20190221084525.GI4525@dhcp22.suse.cz> References: <20190221040130.8940-1-zbestahu@gmail.com> <20190221040130.8940-2-zbestahu@gmail.com> <20190221082309.GG4525@dhcp22.suse.cz> <20190221083624.GD6397@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190221083624.GD6397@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 21-02-19 09:36:24, Greg KH wrote: > On Thu, Feb 21, 2019 at 09:23:09AM +0100, Michal Hocko wrote: > > On Thu 21-02-19 12:01:30, Yue Hu wrote: > > > From: Yue Hu > > > > > > If debugfs_create_dir() failed, the following debugfs_create_file() > > > will be meanless since it depends on non-NULL tmp dentry and it will > > > only waste CPU resource. > > > > The file will be created in the debugfs root. But, more importantly. > > Greg (CCed now) is working on removing the failure paths because he > > believes they do not really matter for debugfs and they make code more > > ugly. More importantly a check for NULL is not correct because you > > get ERR_PTR after recent changes IIRC. > > > > > > > > Signed-off-by: Yue Hu > > > --- > > > mm/cma_debug.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/mm/cma_debug.c b/mm/cma_debug.c > > > index 2c2c869..3e9d984 100644 > > > --- a/mm/cma_debug.c > > > +++ b/mm/cma_debug.c > > > @@ -169,6 +169,8 @@ static void cma_debugfs_add_one(struct cma *cma, struct dentry *root_dentry) > > > scnprintf(name, sizeof(name), "cma-%s", cma->name); > > > > > > tmp = debugfs_create_dir(name, root_dentry); > > > + if (!tmp) > > > + return; > > Ick, yes, this patch isn't ok, I've been doing lots of work to rip these > checks out :) Btw. I believe that it would help to clarify this stance in the kerneldoc otherwise these checks will be returning back because the general kernel development attitude is to check for errors. As I've said previously debugfs being different is ugly but decision is yours. -- Michal Hocko SUSE Labs