Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp261778imp; Thu, 21 Feb 2019 00:37:36 -0800 (PST) X-Google-Smtp-Source: AHgI3IYI8zVQugx5X+mtCpzPn05Z55obnIYqiCpqwRemAQbddOUopW55PVcbGtlnyzWnCQokeqQN X-Received: by 2002:a17:902:9a09:: with SMTP id v9mr36092816plp.225.1550738256567; Thu, 21 Feb 2019 00:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550738256; cv=none; d=google.com; s=arc-20160816; b=kMpu8LLp0wtbI+3Ad7Ckt1qQSy7HWUpZTxxgW2WuHAqrxK7uUtFMljY3dsRybocXcj /SKQfCqzwjA65XYIqk1LghX2ZoqCjGG29OSxeuo2raoCCb5Dp2e1dMKinhZNEaf1OchV ROBNGcZQThSJ6M8kwQxRGrJHINl70e7I0iDy5Gyl3abxqXNDQ1V66rKXsY5xJJ8O6uah +hh1AyVFnMwkf+MpaOSed4jpM7SpDcgfMBijwuh1N5QVD4SuXQWOmUxz0OxFqvlbcA3k ptW3ROZJjxPxqOIU9fkYYP/RjbkPrsorJG753i7xFW0MTiJLOk08FbOka5MTiCvpu3p0 BGlA== 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:dkim-signature; bh=OENLB5A16nbt6Kbu7tqpTEQFaWtUeWTrR4fTVLxFwHU=; b=fpgUI6jbHvZj3Oy3am+5dLcfLaCDKUtjS45yT90m2MSqltXlQDMIhsAiLfoGn4GDxj G3HWLToV7bfI5u0NUjl2DVIcfBoT5/yGwyrOFrh6YfYZx0d/DNdRFiSDIcWLbvEnBxBS Gw5RQ31+dVvC5PPr6+d7FjTh/ckkfcmo11qmsEXgJBLJtEubF1LEk99J0nwak4SZoN5h dNaDbkAqMoydw9ip/HXe2Fqewl4XlP4aFAlQtywE2de9gmLL3VEGFPCWAuukyPgjRJD2 yws2kxEqo2Q51mQeikj8gb0rGwh1icfg+SQ033immKIwpeNDSPObIQbktFVYvYnClPso W8pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rEpnOzvY; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n32si20386500pgm.439.2019.02.21.00.37.21; Thu, 21 Feb 2019 00:37:36 -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; dkim=pass header.i=@kernel.org header.s=default header.b=rEpnOzvY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726754AbfBUIg2 (ORCPT + 99 others); Thu, 21 Feb 2019 03:36:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:33826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbfBUIg2 (ORCPT ); Thu, 21 Feb 2019 03:36:28 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A0D6B20842; Thu, 21 Feb 2019 08:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550738188; bh=BLC5WO9lZNuzlf6omeBaA0Qh70h77drVc5zvXoTJsuw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rEpnOzvYpgGQJzbfFxZIVbAc35BxXy/fA9cad4UXCo7lPMCUjuBdsNuUH7GsS+5aZ Me/ansqbIulB2fjysvYXwgnS1KdeohgMUdzQmmvg/Pf6mC7fzlUAHWMQDRKw9BKgje UkP9kfVNTcX1LqDvgqcu4qfLilepE5b8fwg07yRQ= Date: Thu, 21 Feb 2019 09:36:24 +0100 From: Greg KH To: Michal Hocko 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: <20190221083624.GD6397@kroah.com> References: <20190221040130.8940-1-zbestahu@gmail.com> <20190221040130.8940-2-zbestahu@gmail.com> <20190221082309.GG4525@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190221082309.GG4525@dhcp22.suse.cz> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 :) Thanks for catching this Michal. greg k-h