From: Kees Cook <keescook@chromium.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Anton Vorontsov <anton@enomsg.org>,
Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pstore: no need to check return value of debugfs_create functions
Date: Thu, 20 Jun 2019 11:16:04 -0700 [thread overview]
Message-ID: <201906201115.37C12233AB@keescook> (raw)
In-Reply-To: <20190612152033.GA17290@kroah.com>
On Wed, Jun 12, 2019 at 05:20:33PM +0200, Greg Kroah-Hartman wrote:
> When calling debugfs functions, there is no need to ever check the
> return value. The function can work or not, but the code logic should
> never do something different based on this.
>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Anton Vorontsov <anton@enomsg.org>
> Cc: Colin Cross <ccross@android.com>
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thanks; applied to my for-next/pstore tree.
-Kees
> ---
> fs/pstore/ftrace.c | 18 ++----------------
> 1 file changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/fs/pstore/ftrace.c b/fs/pstore/ftrace.c
> index b8a0931568f8..fd9468928bef 100644
> --- a/fs/pstore/ftrace.c
> +++ b/fs/pstore/ftrace.c
> @@ -120,27 +120,13 @@ static struct dentry *pstore_ftrace_dir;
>
> void pstore_register_ftrace(void)
> {
> - struct dentry *file;
> -
> if (!psinfo->write)
> return;
>
> pstore_ftrace_dir = debugfs_create_dir("pstore", NULL);
> - if (!pstore_ftrace_dir) {
> - pr_err("%s: unable to create pstore directory\n", __func__);
> - return;
> - }
> -
> - file = debugfs_create_file("record_ftrace", 0600, pstore_ftrace_dir,
> - NULL, &pstore_knob_fops);
> - if (!file) {
> - pr_err("%s: unable to create record_ftrace file\n", __func__);
> - goto err_file;
> - }
>
> - return;
> -err_file:
> - debugfs_remove(pstore_ftrace_dir);
> + debugfs_create_file("record_ftrace", 0600, pstore_ftrace_dir, NULL,
> + &pstore_knob_fops);
> }
>
> void pstore_unregister_ftrace(void)
> --
> 2.22.0
>
--
Kees Cook
prev parent reply other threads:[~2019-06-20 18:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 15:20 [PATCH] pstore: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-20 18:16 ` Kees Cook [this message]
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=201906201115.37C12233AB@keescook \
--to=keescook@chromium.org \
--cc=anton@enomsg.org \
--cc=ccross@android.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@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