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, 10 Sep 2014 09:49:17 -0700
From:	Darren Hart <dvhart@...radead.org>
To:	Frans Klaver <fransklaver@...il.com>
Cc:	Paul Bolle <pebolle@...cali.nl>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Corentin Chary <corentin.chary@...il.com>,
	Matthew Garrett <matthew.garrett@...ula.com>,
	acpi4asus-user <acpi4asus-user@...ts.sourceforge.net>,
	platform-driver-x86 <platform-driver-x86@...r.kernel.org>,
	linux-kernel@...r.kernel.org,
	Rafael Wysocki <rafael.j.wysocki@...el.com>
Subject: Re: [PATCH] eeepc-laptop: remove possible use of uninitialized value

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@...radead.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ