[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190221040130.8940-2-zbestahu@gmail.com>
Date: Thu, 21 Feb 2019 12:01:30 +0800
From: Yue Hu <zbestahu@...il.com>
To: akpm@...ux-foundation.org, mhocko@...e.com, rientjes@...gle.com,
joe@...ches.com
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, huyue2@...ong.com
Subject: [PATCH] mm/cma_debug: Check for null tmp in cma_debugfs_add_one()
From: Yue Hu <huyue2@...ong.com>
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.
Signed-off-by: Yue Hu <huyue2@...ong.com>
---
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
Powered by blists - more mailing lists