linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Jagdish Gediya <jvgediya@linux.ibm.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	ying.huang@intel.com, dave.hansen@intel.com,
	Jonathan.Cameron@huawei.com, adobriyan@gmail.com,
	akpm@linux-foundation.org, rf@opensource.cirrus.com,
	pmladek@suse.com, will@kernel.org
Subject: Re: [PATCH v3 1/2] lib/kstrtox.c: Add "false"/"true" support to kstrtobool()
Date: Fri, 29 Jul 2022 17:35:26 +0300	[thread overview]
Message-ID: <YuPwLq+D8k53GZa3@smile.fi.intel.com> (raw)
In-Reply-To: <Yt605xj898VSAsA3@casper.infradead.org>

On Mon, Jul 25, 2022 at 04:21:11PM +0100, Matthew Wilcox wrote:
> On Mon, Jul 25, 2022 at 03:55:27PM +0100, Mark Rutland wrote:
> > On Tue, Apr 26, 2022 at 11:32:02PM +0530, Jagdish Gediya wrote:
> > > At many places in kernel, It is necessary to convert sysfs input
> > > to corrosponding bool value e.g. "false" or "0" need to be converted
> > > to bool false, "true" or "1" need to be converted to bool true,
> > > places where such conversion is needed currently check the input
> > > string manually, kstrtobool() can be utilized at such places but
> > > currently it doesn't have support to accept "false"/"true".
> > > 
> > > Add support to accept "false"/"true" as valid string in kstrtobool().
> > > 
> > > Signed-off-by: Jagdish Gediya <jvgediya@linux.ibm.com>
> > > Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> > 
> > I've just spotted that this broke arm64's "rodata=full" command line option,
> 
> That isn't a documented option.
> 
>         rodata=         [KNL]
>                 on      Mark read-only kernel memory as read-only (default).
>                 off     Leave read-only kernel memory writable for debugging.
> 
> Hopefully this is an object lesson in why you need to update the
> documentation when you extend a feature.
> 
> > since "full" gets parsed as 'f' = FALSE, when previously that would have been
> > rejected. So anyone passing "rodata=full" on the command line will have rodata
> > disabled, which is not what they wanted.
> > 
> > The current state of things is a bit messy (we prase the option twice because
> > arch code needs it early), and we can probably fix that with some refactoring,
> > but I do wonder if we actually want to open up the sysfs parsing to accept
> > anything *beginning* with [tTfF] rather than the full "true" and "false"
> > strings as previously, or whether it's worth reverting this for now in case
> > anything else is affected.
> 
> Well, that's going to break people who've started using the new option.
> As a quick fix, how about only allowing either "f\0" or "fa"?

I think we need to be more strict in kstrtobool(), i.e. 'f\0' ('t\0') and 'fal'
('tru') perhaps?


-- 
With Best Regards,
Andy Shevchenko




  parent reply	other threads:[~2022-07-29 14:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 18:02 [PATCH v3 1/2] lib/kstrtox.c: Add "false"/"true" support to kstrtobool() Jagdish Gediya
2022-04-26 18:02 ` [PATCH v3 2/2] mm: Convert sysfs input to bool using kstrtobool() Jagdish Gediya
2022-04-26 19:14 ` [PATCH v3 1/2] lib/kstrtox.c: Add "false"/"true" support to kstrtobool() Matthew Wilcox
2022-04-26 20:40   ` David Laight
2022-04-27 10:21   ` Jagdish Gediya
2022-04-27 15:13 ` Andy Shevchenko
2022-04-27 17:39   ` Andrew Morton
2022-04-27 18:17     ` Andy Shevchenko
2022-04-27 18:19       ` Andy Shevchenko
2022-07-25 14:55 ` Mark Rutland
2022-07-25 15:21   ` Matthew Wilcox
2022-07-25 15:36     ` Mark Rutland
2022-07-29 14:35     ` Andy Shevchenko [this message]
2022-07-29 14:36       ` Andy Shevchenko
2022-08-25 13:39         ` Petr Mladek
2022-08-26 10:35           ` Will Deacon
2022-07-29 15:17       ` Alexey Dobriyan
2022-07-29 15:32         ` Andy Shevchenko

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=YuPwLq+D8k53GZa3@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=jvgediya@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=pmladek@suse.com \
    --cc=rf@opensource.cirrus.com \
    --cc=will@kernel.org \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).