Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1207866 > unrolled thread

[PATCH] mm/memblock: validate the creation of debugfs files

Started byAlexander Kuleshov <kuleshovmail@gmail.com>
First post2015-08-14 21:10 +0200
Last post2015-08-14 21:20 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm/memblock: validate the creation of debugfs files Alexander Kuleshov <kuleshovmail@gmail.com> - 2015-08-14 21:10 +0200
    Re: [PATCH] mm/memblock: validate the creation of debugfs files Alexander Kuleshov <kuleshovmail@gmail.com> - 2015-08-14 21:20 +0200

#1207866 — [PATCH] mm/memblock: validate the creation of debugfs files

FromAlexander Kuleshov <kuleshovmail@gmail.com>
Date2015-08-14 21:10 +0200
Subject[PATCH] mm/memblock: validate the creation of debugfs files
Message-ID<pXswx-2Ca-5@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1207870

FromAlexander Kuleshov <kuleshovmail@gmail.com>
Date2015-08-14 21:20 +0200
Message-ID<pXsGe-2Nt-15@gated-at.bofh.it>
In reply to#1207866
On 08-15-15, Alexander Kuleshov wrote:
> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
> ---
>  mm/memblock.c | 24 +++++++++++++++++++++---
>  1 file changed, 21 insertions(+), 3 deletions(-)
>

Sorry for noise, skip the first patch please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web