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]
Message-ID: <alpine.LSU.2.20.1612231413070.5990@pobox.suse.cz>
Date:   Fri, 23 Dec 2016 14:13:45 +0100 (CET)
From:   Miroslav Benes <mbenes@...e.cz>
To:     Josh Poimboeuf <jpoimboe@...hat.com>
cc:     Petr Mladek <pmladek@...e.com>, Jessica Yu <jeyu@...hat.com>,
        Jiri Kosina <jikos@...nel.org>, linux-kernel@...r.kernel.org,
        live-patching@...r.kernel.org,
        Michael Ellerman <mpe@...erman.id.au>,
        Heiko Carstens <heiko.carstens@...ibm.com>, x86@...nel.org,
        linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org,
        Vojtech Pavlik <vojtech@...e.com>, Jiri Slaby <jslaby@...e.cz>,
        Chris J Arges <chris.j.arges@...onical.com>,
        Andy Lutomirski <luto@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v3 11/15] livepatch: use kstrtobool() in
 enabled_store()

On Fri, 16 Dec 2016, Josh Poimboeuf wrote:

> On Fri, Dec 16, 2016 at 05:55:55PM +0100, Petr Mladek wrote:
> > On Thu 2016-12-08 12:08:36, Josh Poimboeuf wrote:
> > > The sysfs enabled value is a boolean, so kstrtobool() is a better fit
> > > for parsing the input string since it does the range checking for us.
> > > 
> > > Suggested-by: Petr Mladek <pmladek@...e.com>
> > > Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
> > > ---
> > >  kernel/livepatch/core.c | 11 ++++-------
> > >  1 file changed, 4 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> > > index 6a137e1..8ca8a0e 100644
> > > --- a/kernel/livepatch/core.c
> > > +++ b/kernel/livepatch/core.c
> > > @@ -408,26 +408,23 @@ static ssize_t enabled_store(struct kobject *kobj, struct kobj_attribute *attr,
> > >  {
> > >  	struct klp_patch *patch;
> > >  	int ret;
> > > -	unsigned long val;
> > > +	bool enabled;
> > >  
> > > -	ret = kstrtoul(buf, 10, &val);
> > > +	ret = kstrtobool(buf, &enabled);
> > >  	if (ret)
> > >  		return -EINVAL;
> > 
> > I would return "ret" here. It is -EINVAL as well but... ;-)
> 
> That was a preexisting issue with the kstrtoul() return code, but I'll
> sneak your suggested change into this patch if nobody objects.

Fine with me.

Acked-by: Miroslav Benes <mbenes@...e.cz>

Miroslav

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ