Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp273784imp; Thu, 21 Feb 2019 00:57:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IbRC8FQP2MU0XwFkJ9zMJjV30bExkgUWkgWls0EMw5RmG5omFnjgp4pGrxIfIM9BzURNh4E X-Received: by 2002:a63:f806:: with SMTP id n6mr11223645pgh.19.1550739458957; Thu, 21 Feb 2019 00:57:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739458; cv=none; d=google.com; s=arc-20160816; b=Lt2SEBHQnnl/ZjivYmiG4lBed4eekhbhAERD72Bs+vSQfeKg9VbDr9+mJeeFdDng0V mYf600m4STj+15nMRSv+ClcP+YdcybFejS1AKtT5Tqa41ZBB07Yb05s3pAP4gGKzjThZ Bghh9OFgywrSQsiGKKTaSioXlAp99RBS5anGYi73MDsQOZlE6eqOkIv4zvw9xf08OaCs tmw0+ptPDwW4LogpdFq+xbDX4j8aPETMSFjspTUpw1S4V7SRbowi5owDR38oOrtiD/IB 45iPqv+fjj7aovjHTu5HQn4aRoSb0ONLufC1VXxVgnhP2qUz28DyRL6lJ2NCuAfrorZJ SjUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=VfKdvQKNjhi7GLOZO2B6g+shK7xwZm6nI7j0UxgbSvM=; b=Ake/c+wjh2YCJtM61sN8sP78TC4eze7SD/rkmtdO5YXB/+5uVmmr/nplQFaTWb3WNq mWzodAkMEBNpvPoj001iaJiuKB0hj9I/cL2b08h72j6f9b4bYr3RmHvNhaqTHDIlbDb0 wgmXSy2QH/sWcSdTBeDvK1e29IDOkjE5GVIu38UdhLxIXN75z0uw8ydtowXhxXEqMzGL FWT0VevmiLTJxDL21x0ZbcbXieCBBrTducW4SFYvYM5995XlGQfWBQGQZc0DxxYVJtCa i8kWhI4Nmgzw1fMIYWAyNXEGbw8uDC3u1Jc1Xtfn2kVcu+jNNNDAgKI6gAviKQesdNSy /JLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="UtzSOKv/"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bf7si14021336plb.33.2019.02.21.00.57.23; Thu, 21 Feb 2019 00:57:38 -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=@gmail.com header.s=20161025 header.b="UtzSOKv/"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726350AbfBUI4z (ORCPT + 99 others); Thu, 21 Feb 2019 03:56:55 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:33342 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbfBUI4y (ORCPT ); Thu, 21 Feb 2019 03:56:54 -0500 Received: by mail-pf1-f194.google.com with SMTP id i19so414039pfd.0 for ; Thu, 21 Feb 2019 00:56:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VfKdvQKNjhi7GLOZO2B6g+shK7xwZm6nI7j0UxgbSvM=; b=UtzSOKv/Xh1sDFxxAUXHybgPjqXRzpCOAITL9VzkE581nWD6aM9fjNiyr1SAsHTuRd +JXVtMVOSGbagP5TvHwGp/KyKZr/SiMJKpMQkAYT2x4eTtfyRU+urXUn0UbUAEKO+j1r MGEdc1mxhzA/q86wVU5/BMdRHefQAK7meLBrqJxv3unkeekGYgkTo8fIPJkpHI+YyezD XZDd3i3S1W4CurtkHOxonlMjN3kDnF6ZeboH8KRPc94Zg9tpscAMzN+yIuK/GaMLKoK1 FyONS6ubj+UxhFssXAxponQXH2cutYksp3PtYtRzFsx1ZsEV/aFJ5ifC229jU41aD5uz 00CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VfKdvQKNjhi7GLOZO2B6g+shK7xwZm6nI7j0UxgbSvM=; b=Lajyv75IZZW9uQf3ra5Sg+C2Kdvc696caLimysJM17pwNDlR5vTonHExnm4ETszhef PgCNNE16AKM5lLl4SZHkaueRzzw3slvVYsREQB91nKIXfRU7iYH7aQNx9YvlLll56CoR k0XxCZTOwQQcfvap7NzPYfWR6HRy6nCyN1E9IhBWOHCE9RfKvIfMrDV4EjDBpB6FFJh4 5/eqi7JfjVo4aH8F1mPJQfquCvYUM9KSQD6YAB97RdIx+CQ+/qcZXn+Ya4qbh027Lxb+ e3Wf+d7RztBZdBnq/BdAbDK2HkpdVQHKMAhDqYqCuE6eVfvYDYJOSqYO8Nlnn2IInv+n VbFQ== X-Gm-Message-State: AHQUAub/+e8uGx15cDongTj/S5fsVs+Ratextbiby3FQpwXPip6nZUto FB8LwcPLRAGoG47pRpR45Ak= X-Received: by 2002:aa7:85cc:: with SMTP id z12mr39513394pfn.196.1550739413958; Thu, 21 Feb 2019 00:56:53 -0800 (PST) Received: from localhost ([218.189.10.173]) by smtp.gmail.com with ESMTPSA id o2sm30314231pgq.29.2019.02.21.00.56.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 00:56:53 -0800 (PST) Date: Thu, 21 Feb 2019 16:56:42 +0800 From: Yue Hu To: Michal Hocko Cc: akpm@linux-foundation.org, rientjes@google.com, joe@perches.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, huyue2@yulong.com, Greg KH Subject: Re: [PATCH] mm/cma_debug: Check for null tmp in cma_debugfs_add_one() Message-ID: <20190221165642.00005d86.zbestahu@gmail.com> In-Reply-To: <20190221082309.GG4525@dhcp22.suse.cz> References: <20190221040130.8940-1-zbestahu@gmail.com> <20190221040130.8940-2-zbestahu@gmail.com> <20190221082309.GG4525@dhcp22.suse.cz> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Feb 2019 09:23:09 +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. Same check logic in cma_debugfs_init(), i'm just finding they do not stay the same. > > > > > 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; > > > > debugfs_create_file("alloc", 0200, tmp, cma, &cma_alloc_fops); > > debugfs_create_file("free", 0200, tmp, cma, &cma_free_fops); > > -- > > 1.9.1 > > >