From: Darren Hart <dvhart@infradead.org>
To: Frans Klaver <fransklaver@gmail.com>
Cc: Paul Bolle <pebolle@tiscali.nl>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Corentin Chary <corentin.chary@gmail.com>,
Matthew Garrett <matthew.garrett@nebula.com>,
acpi4asus-user <acpi4asus-user@lists.sourceforge.net>,
platform-driver-x86 <platform-driver-x86@vger.kernel.org>,
linux-kernel@vger.kernel.org,
Rafael Wysocki <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH] eeepc-laptop: remove possible use of uninitialized value
Date: Wed, 10 Sep 2014 09:49:17 -0700 [thread overview]
Message-ID: <20140910164916.GA48285@vmdeb7> (raw)
In-Reply-To: <CAH6sp9NtLDG4AvpTF7KzxwxVhrj8ZzNLugwoU5=YrLp65AptQQ@mail.gmail.com>
On Wed, Sep 10, 2014 at 04:42:49PM +0200, Frans Klaver wrote:
> On Wed, Sep 10, 2014 at 5:33 AM, Darren Hart <dvhart@infradead.org> wrote:
> > On Tue, Sep 09, 2014 at 10:50:08AM +0200, Paul Bolle wrote:
> >> Hi Darren,
> >>
> >> On Sat, 2014-09-06 at 23:17 +0200, Rafael J. Wysocki wrote:
> >> > On Friday, September 05, 2014 07:17:57 PM Darren Hart wrote:
> >> > > On Thu, Sep 04, 2014 at 09:08:08AM +0200, Paul Bolle wrote:
> >> > > [...]
> >> > > > static ssize_t store_sys_acpi(struct device *dev, int cm,
> >> > > > @@ -278,12 +276,13 @@ static ssize_t store_sys_acpi(struct device *dev, int cm,
> >> > > > struct eeepc_laptop *eeepc = dev_get_drvdata(dev);
> >> > > > int rv, value;
> >> > > >
> >> > > > - rv = parse_arg(buf, count, &value);
> >> > > > - if (rv > 0)
> >> > > > - value = set_acpi(eeepc, cm, value);
> >> > > > + rv = parse_arg(buf, &value);
> >> > > > + if (rv < 0)
> >> > > > + return rv;
> >> > > > + value = set_acpi(eeepc, cm, value);
> >> > > > if (value < 0)
> >> > >
> >> > > I suppose it's harmless, but it would be more explicit to reuse rv here instead
> >> > > of value.
> >>
> >> Fine with me.
> >>
> >> > > > return -EIO;
> >> > >
> >> > > And as with Frans' version, I suggest propogating the error. We're talking about
> >> > > a missing/invalid ACPI control method name here, ENODEV seems approprirate.
> >> > >
> >> > > Rafael, do you have a strong preference about what to return in such an event?
> >> >
> >> > No, I don't, although -ENXIO could be used here too.
> >>
> >> If you could say what value you'd like best I'll resend using that
> >> value. (I don't know what the effect is of using a specific error here,
> >> so I guess I'll have to bluff about it in the commit explanation.)
> >
> > First, I would prefer we propogate the error code rather than remap it.
> >
> > We could consider changing what the callee returns...
> >
> > #define EIO 5 /* I/O error */
> > #define ENXIO 6 /* No such device or address */
> > #define ENODEV 19 /* No such device */
> >
> > Of those, ENXIO seems like the most appropriate in this case.
>
> Would it be fair to say that for consistency we should then also
> change the return values of acpi_setter_handle()? It has the same
> basic layout and checks as set_acpi() and get_acpi() have.
Yes, that would be appropriate as well.
--
Darren Hart
Intel Open Source Technology Center
next prev parent reply other threads:[~2014-09-10 16:49 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 22:53 [PATCH] eeepc-laptop: remove possible use of uninitialized value Frans Klaver
2014-09-04 0:49 ` Darren Hart
2014-09-04 1:14 ` Greg Kroah-Hartman
2014-09-04 6:46 ` Frans Klaver
2014-09-04 14:10 ` Greg Kroah-Hartman
2014-09-04 14:40 ` Frans Klaver
2014-09-04 19:37 ` Paul Bolle
2014-09-04 7:08 ` Paul Bolle
2014-09-04 7:57 ` Frans Klaver
2014-09-06 2:17 ` Darren Hart
2014-09-06 21:17 ` Rafael J. Wysocki
2014-09-08 21:12 ` [PATCH] eeepc-laptop: remove disp attribute show function Frans Klaver
2014-09-08 21:16 ` Greg Kroah-Hartman
[not found] ` <20140908212306.GA22145@gmail.com>
[not found] ` <20140908214438.GB22145@gmail.com>
2014-09-08 21:57 ` Greg Kroah-Hartman
2014-09-08 23:32 ` Darren Hart
2014-09-09 8:50 ` [PATCH] eeepc-laptop: remove possible use of uninitialized value Paul Bolle
2014-09-10 3:33 ` Darren Hart
2014-09-10 14:42 ` Frans Klaver
2014-09-10 16:49 ` Darren Hart [this message]
2014-09-10 20:05 ` [PATCH v2] eeepc-laptop: simplify parse_arg() Paul Bolle
2014-09-11 22:37 ` Darren Hart
2014-09-16 23:45 ` Darren Hart
2014-09-17 19:02 ` [PATCH v3] " Paul Bolle
2014-09-17 20:14 ` Darren Hart
2014-09-17 20:35 ` Darren Hart
2014-09-17 20:36 ` Frans Klaver
2014-09-17 21:39 ` Frans Klaver
2014-09-09 0:06 ` [PATCH] eeepc-laptop: remove possible use of uninitialized value Darren Hart
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=20140910164916.GA48285@vmdeb7 \
--to=dvhart@infradead.org \
--cc=acpi4asus-user@lists.sourceforge.net \
--cc=corentin.chary@gmail.com \
--cc=fransklaver@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.garrett@nebula.com \
--cc=pebolle@tiscali.nl \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
/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