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]
Date:   Wed, 12 Jun 2019 13:26:38 -0400
From:   Joel Fernandes <joel@...lfernandes.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Qian Cai <cai@....us>, Thomas Gleixner <tglx@...utronix.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Waiman Long <longman@...hat.com>,
        Zhong Jiang <zhongjiang@...wei.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] lib: debugobjects: no need to check return value of
 debugfs_create functions

On Wed, Jun 12, 2019 at 1:10 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> On Wed, Jun 12, 2019 at 12:58:19PM -0400, Joel Fernandes wrote:
> > On Wed, Jun 12, 2019 at 05:35:13PM +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: Qian Cai <cai@....us>
> > > Cc: Thomas Gleixner <tglx@...utronix.de>
> > > Cc: Andrew Morton <akpm@...ux-foundation.org>
> > > Cc: Waiman Long <longman@...hat.com>
> > > Cc: "Joel Fernandes (Google)" <joel@...lfernandes.org>
> > > Cc: Zhong Jiang <zhongjiang@...wei.com>
> > > Cc: linux-kernel@...r.kernel.org
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > > ---
> > >  lib/debugobjects.c | 14 ++------------
> > >  1 file changed, 2 insertions(+), 12 deletions(-)
> > >
> > > diff --git a/lib/debugobjects.c b/lib/debugobjects.c
> > > index 55437fd5128b..2ac42286cd08 100644
> > > --- a/lib/debugobjects.c
> > > +++ b/lib/debugobjects.c
> > > @@ -850,26 +850,16 @@ static const struct file_operations debug_stats_fops = {
> > >
> > >  static int __init debug_objects_init_debugfs(void)
> > >  {
> > > -   struct dentry *dbgdir, *dbgstats;
> > > +   struct dentry *dbgdir;
> > >
> > >     if (!debug_objects_enabled)
> > >             return 0;
> > >
> > >     dbgdir = debugfs_create_dir("debug_objects", NULL);
> > > -   if (!dbgdir)
> > > -           return -ENOMEM;
> > >
> > > -   dbgstats = debugfs_create_file("stats", 0444, dbgdir, NULL,
> > > -                                  &debug_stats_fops);
> > > -   if (!dbgstats)
> > > -           goto err;
> > > +   debugfs_create_file("stats", 0444, dbgdir, NULL, &debug_stats_fops);
> >
> >
> > One weirdness is, if dbgdir is ever NULL, then debugfs_create_file() may end
> > up creating the stats file in the root.
>
> Yes, but dbgdir can not be NULL.

Makes sense, thanks for clarification,

- Joel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ