* [PATCH] mm/cma_debug: Check return value of the debugfs_create_dir()
@ 2015-08-25 7:52 Alexander Kuleshov
2015-08-27 15:38 ` Michal Nazarewicz
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kuleshov @ 2015-08-25 7:52 UTC (permalink / raw)
To: Andrew Morton, Joonsoo Kim, Michal Nazarewicz, Sasha Levin,
Stefan Strogin, Dmitry Safonov
Cc: linux-mm, linux-kernel, Alexander Kuleshov
The debugfs_create_dir() function may fail and return error. If the
root directory not created, we can't create anything inside it. This
patch adds check for this case.
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
mm/cma_debug.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index f8e4b60..bfb46e2 100644
--- a/mm/cma_debug.c
+++ b/mm/cma_debug.c
@@ -171,6 +171,9 @@ static void cma_debugfs_add_one(struct cma *cma, int idx)
tmp = debugfs_create_dir(name, cma_debugfs_root);
+ if (!tmp)
+ return;
+
debugfs_create_file("alloc", S_IWUSR, tmp, cma,
&cma_alloc_fops);
--
2.5.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/cma_debug: Check return value of the debugfs_create_dir()
2015-08-25 7:52 [PATCH] mm/cma_debug: Check return value of the debugfs_create_dir() Alexander Kuleshov
@ 2015-08-27 15:38 ` Michal Nazarewicz
0 siblings, 0 replies; 2+ messages in thread
From: Michal Nazarewicz @ 2015-08-27 15:38 UTC (permalink / raw)
To: Alexander Kuleshov, Andrew Morton, Joonsoo Kim, Sasha Levin,
Stefan Strogin, Dmitry Safonov
Cc: linux-mm, linux-kernel
On Tue, Aug 25 2015, Alexander Kuleshov wrote:
> The debugfs_create_dir() function may fail and return error. If the
> root directory not created, we can't create anything inside it. This
> patch adds check for this case.
>
> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
I’d also add a pr_warn but otherwise:
Acked-by: Michal Nazarewicz <mina86@mina86.com>
> ---
> mm/cma_debug.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/mm/cma_debug.c b/mm/cma_debug.c
> index f8e4b60..bfb46e2 100644
> --- a/mm/cma_debug.c
> +++ b/mm/cma_debug.c
> @@ -171,6 +171,9 @@ static void cma_debugfs_add_one(struct cma *cma, int idx)
>
> tmp = debugfs_create_dir(name, cma_debugfs_root);
>
> + if (!tmp)
> + return;
> +
> debugfs_create_file("alloc", S_IWUSR, tmp, cma,
> &cma_alloc_fops);
>
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, ミハウ “mina86” ナザレヴイツ (o o)
ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>-----ooO--(_)--Ooo--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-27 15:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-25 7:52 [PATCH] mm/cma_debug: Check return value of the debugfs_create_dir() Alexander Kuleshov
2015-08-27 15:38 ` Michal Nazarewicz
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).