From: Alexander Kuleshov <kuleshovmail@gmail.com>
To: Tomas Winkler <tomas.winkler@intel.com>
Cc: linux-kernel@vger.kernel.org,
Alexander Kuleshov <kuleshovmail@gmail.com>
Subject: [PATCH] mm/memblock: validate the creation of debugfs files
Date: Sat, 15 Aug 2015 01:08:11 +0600 [thread overview]
Message-ID: <1439579292-15458-1-git-send-email-kuleshovmail@gmail.com> (raw)
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
mm/memblock.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 87108e7..c09e911 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1692,16 +1692,34 @@ static const struct file_operations memblock_debug_fops = {
static int __init memblock_init_debugfs(void)
{
+ struct dentry *f;
struct dentry *root = debugfs_create_dir("memblock", NULL);
if (!root)
return -ENXIO;
- debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
- debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);
+
+ f = debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
+ if (!f) {
+ pr_err("Failed to create memory debugfs file\n");
+ goto err_out;
+ }
+
+ f = debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);
+ if (!f) {
+ pr_err("Failed to create reserved debugfs file\n");
+ goto err_out;
+ }
+
#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
- debugfs_create_file("physmem", S_IRUGO, root, &memblock.physmem, &memblock_debug_fops);
+ f = debugfs_create_file("physmem", S_IRUGO, root, &memblock.physmem, &memblock_debug_fops);
+ if (!f) {
+ pr_err("Failed to create physmem debugfs file\n");
+ goto err_out;
+ }
#endif
return 0;
+err_out:
+ return -ENOMEM;
}
__initcall(memblock_init_debugfs);
--
2.5.0
next reply other threads:[~2015-08-14 19:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-14 19:08 Alexander Kuleshov [this message]
2015-08-14 19:08 ` [PATCH] misc/mei: Fix debugfs filename in error output Alexander Kuleshov
2015-08-14 19:13 ` [PATCH] mm/memblock: validate the creation of debugfs files Alexander Kuleshov
-- strict thread matches above, loose matches on Subject: below --
2015-08-14 19:03 Alexander Kuleshov
2015-08-14 21:19 ` Andrew Morton
2015-08-15 7:26 ` Alexander Kuleshov
2015-08-15 7:38 ` Andrew Morton
2015-08-15 7:48 ` Alexander Kuleshov
2015-08-15 7:52 ` Andrew Morton
2015-08-15 16:07 ` Greg Kroah-Hartman
2015-08-17 22:05 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439579292-15458-1-git-send-email-kuleshovmail@gmail.com \
--to=kuleshovmail@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tomas.winkler@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).