linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minfei Huang <mnghuan@gmail.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: akpm@linux-foundation.org, labbott@fedoraproject.org,
	rjw@rjwysocki.net, mgorman@techsingularity.net, vbabka@suse.cz,
	rientjes@google.com, kirill.shutemov@linux.intel.com,
	iamjoonsoo.kim@lge.com, izumi.taku@jp.fujitsu.com,
	alexander.h.duyck@redhat.com, hannes@cmpxchg.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Use existing helper to convert "on/off" to boolean
Date: Fri, 29 Apr 2016 17:07:42 +0800	[thread overview]
Message-ID: <20160429090742.GA16688@dhcp-128-44.nay.redhat.com> (raw)
In-Reply-To: <20160429080430.GA21977@dhcp22.suse.cz>

On 04/29/16 at 10:04P, Michal Hocko wrote:
> On Fri 29-04-16 13:47:04, Minfei Huang wrote:
> > It's more convenient to use existing function helper to convert string
> > "on/off" to boolean.
> 
> But kstrtobool in linux-next only does "This routine returns 0 iff the
> first character is one of 'Yy1Nn0'" so it doesn't know about on/off.
> Or am I missing anything?

Hi, Michal.

Thanks for your reply.

Following is the kstrtobool comment from linus tree, which has explained
that this function can parse "on"/"off" string. Also Kees Cook has
posted such patch to fix this issue as well. So I think it's safe to fix
it.

"
  This routine returns 0 if the first character is one of 'Yy1Nn0', or
  [oO][NnFf] for "on" and "off". Otherwise it will return -EINVAL.  Value
  pointed to by res is updated upon finding a match.
"

  commit 4cc7ecb7f2a60e8deb783b8fbf7c1ae467acb920
  Author: Kees Cook <keescook@chromium.org>
  Date:   Thu Mar 17 14:23:00 2016 -0700
  
      param: convert some "on"/"off" users to strtobool
  
      This changes several users of manual "on"/"off" parsing to use
      strtobool.
  
      Some side-effects:
      - these uses will now parse y/n/1/0 meaningfully too
      - the early_param uses will now bubble up parse errors

Thanks
Minfei

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-04-29  9:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29  5:47 Minfei Huang
2016-04-29  8:04 ` Michal Hocko
2016-04-29  9:07   ` Minfei Huang [this message]
2016-04-29  9:21     ` Michal Hocko
2016-04-29 21:21 ` Andrew Morton
2016-04-30  4:47   ` Minfei Huang

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=20160429090742.GA16688@dhcp-128-44.nay.redhat.com \
    --to=mnghuan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=labbott@fedoraproject.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=rientjes@google.com \
    --cc=rjw@rjwysocki.net \
    --cc=vbabka@suse.cz \
    /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