lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jJPyKwM3E=-pnRBJ0NCb4kMB7EtLdS-+5khE76qnEhcdQ@mail.gmail.com>
Date:   Wed, 23 Jan 2019 10:25:53 +1300
From:   Kees Cook <keescook@...omium.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Catalin Marinas <catalin.marinas@....com>,
        Kevin Hilman <khilman@...nel.org>,
        Russell King <linux@...linux.org.uk>,
        Will Deacon <will.deacon@....com>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
        Jinbum Park <jinb.park7@...il.com>,
        Laura Abbott <labbott@...hat.com>
Subject: Re: [PATCH 2/4] arm: dump: no need to check return value of
 debugfs_create functions

On Wed, Jan 23, 2019 at 3:41 AM Greg Kroah-Hartman
<gregkh@...uxfoundation.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@...linux.org.uk>
> Cc: Jinbum Park <jinb.park7@...il.com>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: Laura Abbott <labbott@...hat.com>
> Cc: linux-arm-kernel@...ts.infradead.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.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@...omium.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ