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, 23 Jan 2019 11:33:21 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Ulf Hansson <ulf.hansson@...aro.org>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Kevin Hilman <khilman@...nel.org>,
        Len Brown <len.brown@...el.com>,
        Linux PM <linux-pm@...r.kernel.org>
Subject: Re: [PATCH] power: domain: no need to check return value of
 debugfs_create functions

On Wed, Jan 23, 2019 at 09:20:05AM +0100, Ulf Hansson wrote:
> On Wed, 23 Jan 2019 at 08:59, Greg Kroah-Hartman
> <gregkh@...uxfoundation.org> wrote:
> >
> > On Wed, Jan 23, 2019 at 08:44:36AM +0100, Ulf Hansson wrote:
> > > On Tue, 22 Jan 2019 at 16:23, 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.
> > >
> > > Doesn't this boils done to whether we want to care to check if memory
> > > allocation failed?
> >
> > You should not care.
> 
> Okay.
> 
> >
> > > Somewhere down the call chain from debugfs_create_dir(), we end up in
> > > alloc_inode() and it looks like that can fail, no?
> >
> > Yes it can, right now it will return NULL, I'll go change that to return
> > ENOMEM, but even then, your really do not care what happens as none of
> > your other code flow should ever care about what debugfs does, or does
> > not, do.
> 
> In that case, why don't we convert the debugfs_create_dir() and
> friends, to becomes "void" functions? Or maybe that's your plan going
> forward?

I can't, as sometimes you actually care about using the return value in
another debugfs call.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ