linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Kevin Hilman <khilman@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Will Deacon <will.deacon@arm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Jinbum Park <jinb.park7@gmail.com>,
	Laura Abbott <labbott@redhat.com>
Subject: Re: [PATCH 2/4] arm: dump: no need to check return value of debugfs_create functions
Date: Wed, 23 Jan 2019 10:25:53 +1300	[thread overview]
Message-ID: <CAGXu5jJPyKwM3E=-pnRBJ0NCb4kMB7EtLdS-+5khE76qnEhcdQ@mail.gmail.com> (raw)
In-Reply-To: <20190122144114.9816-3-gregkh@linuxfoundation.org>

On Wed, Jan 23, 2019 at 3:41 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> 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: Russell King <linux@armlinux.org.uk>
> Cc: Jinbum Park <jinb.park7@gmail.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Laura Abbott <labbott@redhat.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Do you mean that it bubbles up to an initcall, and the return value is
meaningless there? This seems fine to me...

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  arch/arm/include/asm/ptdump.h | 9 +++------
>  arch/arm/mm/dump.c            | 4 ++--
>  arch/arm/mm/ptdump_debugfs.c  | 8 ++------
>  3 files changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/arch/arm/include/asm/ptdump.h b/arch/arm/include/asm/ptdump.h
> index 3ebf9718288d..0c2d3d0d4cc6 100644
> --- a/arch/arm/include/asm/ptdump.h
> +++ b/arch/arm/include/asm/ptdump.h
> @@ -21,13 +21,10 @@ struct ptdump_info {
>
>  void ptdump_walk_pgd(struct seq_file *s, struct ptdump_info *info);
>  #ifdef CONFIG_ARM_PTDUMP_DEBUGFS
> -int ptdump_debugfs_register(struct ptdump_info *info, const char *name);
> +void ptdump_debugfs_register(struct ptdump_info *info, const char *name);
>  #else
> -static inline int ptdump_debugfs_register(struct ptdump_info *info,
> -                                       const char *name)
> -{
> -       return 0;
> -}
> +static inline void ptdump_debugfs_register(struct ptdump_info *info,
> +                                          const char *name) { }
>  #endif /* CONFIG_ARM_PTDUMP_DEBUGFS */
>
>  void ptdump_check_wx(void);
> diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
> index 084779c5c893..eb385a500ed0 100644
> --- a/arch/arm/mm/dump.c
> +++ b/arch/arm/mm/dump.c
> @@ -450,7 +450,7 @@ void ptdump_check_wx(void)
>  static int ptdump_init(void)
>  {
>         ptdump_initialize();
> -       return ptdump_debugfs_register(&kernel_ptdump_info,
> -                                       "kernel_page_tables");
> +       ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables");
> +       return 0;
>  }
>  __initcall(ptdump_init);
> diff --git a/arch/arm/mm/ptdump_debugfs.c b/arch/arm/mm/ptdump_debugfs.c
> index be8d87be4b93..598b636615a2 100644
> --- a/arch/arm/mm/ptdump_debugfs.c
> +++ b/arch/arm/mm/ptdump_debugfs.c
> @@ -24,11 +24,7 @@ static const struct file_operations ptdump_fops = {
>         .release        = single_release,
>  };
>
> -int ptdump_debugfs_register(struct ptdump_info *info, const char *name)
> +void ptdump_debugfs_register(struct ptdump_info *info, const char *name)
>  {
> -       struct dentry *pe;
> -
> -       pe = debugfs_create_file(name, 0400, NULL, info, &ptdump_fops);
> -       return pe ? 0 : -ENOMEM;
> -
> +       debugfs_create_file(name, 0400, NULL, info, &ptdump_fops);
>  }
> --
> 2.20.1
>


-- 
Kees Cook

  reply	other threads:[~2019-01-22 21:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 14:41 [PATCH 0/4] ARM: cleanup debugfs usage Greg Kroah-Hartman
2019-01-22 14:41 ` [PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-01-25 18:13   ` Catalin Marinas
2019-01-30 18:21   ` Will Deacon
2019-01-30 19:33     ` Greg Kroah-Hartman
2019-01-31 13:57       ` Will Deacon
2019-01-22 14:41 ` [PATCH 2/4] arm: " Greg Kroah-Hartman
2019-01-22 21:25   ` Kees Cook [this message]
2019-01-23  9:42   ` Laura Abbott
2019-01-22 14:41 ` [PATCH 3/4] arm: omap1: " Greg Kroah-Hartman
2019-01-22 23:05   ` Tony Lindgren
2019-01-22 14:41 ` [PATCH 4/4] arm: omap2: " Greg Kroah-Hartman
2019-01-22 23:06   ` Tony Lindgren

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='CAGXu5jJPyKwM3E=-pnRBJ0NCb4kMB7EtLdS-+5khE76qnEhcdQ@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=catalin.marinas@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jinb.park7@gmail.com \
    --cc=khilman@kernel.org \
    --cc=labbott@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=will.deacon@arm.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).