lkml.org 
[lkml]   [2014]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] eeepc-laptop: remove possible use of uninitialized value
From
Date
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.)

Thanks,


Paul Bolle



\
 
 \ /
  Last update: 2014-09-09 11:21    [W:0.175 / U:0.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site