All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
	Ming Lei <ming.lei@canonical.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	David Howells <dhowells@redhat.com>,
	Seth Forshee <seth.forshee@canonical.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Paul Bolle <pebolle@tiscali.nl>,
	Linux Wireless List <linux-wireless@vger.kernel.org>,
	Kyle McMartin <kyle@kernel.org>
Subject: Re: [PATCH v2 1/5] firmware: fix __getname() missing failure check
Date: Tue, 12 May 2015 22:45:56 +0200	[thread overview]
Message-ID: <20150512204556.GO23057@wotan.suse.de> (raw)
In-Reply-To: <CA+55aFwSQqkA_yzvePe7p-aJkbVJc9od=wLvXvs9B=NcckFfoA@mail.gmail.com>

On Tue, May 12, 2015 at 01:31:58PM -0700, Linus Torvalds wrote:
> On Tue, May 12, 2015 at 11:30 AM, Luis R. Rodriguez
> <mcgrof@do-not-panic.com> wrote:
> > +
> > +       path = __getname();
> > +       if (unlikely(!path))
> > +               return PTR_ERR(path);
> 
> This makes no sense.
> 
> PTR_ERR() on NULL is an insane operation. It's a very non-intuitive
> and misleading way of writing "0".
> 
> So not only is that "return 0;", that's not likely what you want _anyway_.
> 
> If you intended to return an error, you should just have done so, eg
> 
>         if (unlikely(!path))
>                 return -ENOMEM;
> 
> which actually does something sane, and is more readable.

Will fix, thanks.

 Luis

  reply	other threads:[~2015-05-12 20:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 18:30 [PATCH v2 0/5] firmware: few fixes for name uses Luis R. Rodriguez
2015-05-12 18:30 ` [PATCH v2 1/5] firmware: fix __getname() missing failure check Luis R. Rodriguez
2015-05-12 20:31   ` Linus Torvalds
2015-05-12 20:45     ` Luis R. Rodriguez [this message]
2015-05-12 21:21   ` Greg KH
2015-05-12 21:23     ` Luis R. Rodriguez
2015-05-12 18:30 ` [PATCH v2 2/5] firmware: check for file truncation on direct firmware loading Luis R. Rodriguez
2015-05-12 18:30 ` [PATCH v2 3/5] firmware: check for possible file truncation early Luis R. Rodriguez
2015-05-12 20:35   ` Linus Torvalds
2015-05-12 21:06     ` Luis R. Rodriguez
2015-05-12 18:30 ` [PATCH v2 4/5] firmware: fix possible use after free on name on asynchronous request Luis R. Rodriguez
2015-05-12 18:30 ` [PATCH v2 5/5] firmware: use const for remaining firmware names Luis R. Rodriguez

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=20150512204556.GO23057@wotan.suse.de \
    --to=mcgrof@suse.com \
    --cc=dhowells@redhat.com \
    --cc=kyle@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@do-not-panic.com \
    --cc=ming.lei@canonical.com \
    --cc=pebolle@tiscali.nl \
    --cc=rusty@rustcorp.com.au \
    --cc=seth.forshee@canonical.com \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.