All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Nazarewicz <mina86@mina86.com>
To: Alexander Kuleshov <kuleshovmail@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Joonsoo Kim <js1304@gmail.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	Stefan Strogin <stefan.strogin@gmail.com>,
	Dmitry Safonov <d.safonov@partner.samsung.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/cma_debug: Check return value of the debugfs_create_dir()
Date: Thu, 27 Aug 2015 17:38:13 +0200	[thread overview]
Message-ID: <xa1tsi74oi6y.fsf@mina86.com> (raw)
In-Reply-To: <1440489154-3470-1-git-send-email-kuleshovmail@gmail.com>

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>

WARNING: multiple messages have this Message-ID (diff)
From: Michal Nazarewicz <mina86@mina86.com>
To: Alexander Kuleshov <kuleshovmail@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Joonsoo Kim <js1304@gmail.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	Stefan Strogin <stefan.strogin@gmail.com>,
	Dmitry Safonov <d.safonov@partner.samsung.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Alexander Kuleshov <kuleshovmail@gmail.com>
Subject: Re: [PATCH] mm/cma_debug: Check return value of the debugfs_create_dir()
Date: Thu, 27 Aug 2015 17:38:13 +0200	[thread overview]
Message-ID: <xa1tsi74oi6y.fsf@mina86.com> (raw)
In-Reply-To: <1440489154-3470-1-git-send-email-kuleshovmail@gmail.com>

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--

  reply	other threads:[~2015-08-27 15:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25  7:52 [PATCH] mm/cma_debug: Check return value of the debugfs_create_dir() Alexander Kuleshov
2015-08-25  7:52 ` Alexander Kuleshov
2015-08-27 15:38 ` Michal Nazarewicz [this message]
2015-08-27 15:38   ` Michal Nazarewicz

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=xa1tsi74oi6y.fsf@mina86.com \
    --to=mina86@mina86.com \
    --cc=akpm@linux-foundation.org \
    --cc=d.safonov@partner.samsung.com \
    --cc=js1304@gmail.com \
    --cc=kuleshovmail@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sasha.levin@oracle.com \
    --cc=stefan.strogin@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.