mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-kernel@vger.kernel.org, geert@linux-m68k.org,
	jj@chaosbits.net, arnd@arndb.de
Subject: Re: [PATCH] kstrto*: converting strings to integers done (hopefully) right
Date: Tue, 1 Mar 2011 15:24:55 -0800	[thread overview]
Message-ID: <20110301152455.995eb661.akpm@linux-foundation.org> (raw)
In-Reply-To: <20110226124708.GA29242@p183.telecom.by>

On Sat, 26 Feb 2011 14:47:08 +0200
Alexey Dobriyan <adobriyan@gmail.com> wrote:

> 1. simple_strto*() do not contain overflow checks and crufty,
>    libc way to indicate failure.
> 2. strict_strto*() also do not have overflow checks but the name and
>    comments pretend they do.
> 3. Both families have only "long long" and "long" variants,
>    but users want strtou8()
> 4. Both "simple" and "strict" prefixes are wrong:
>    Simple doesn't exactly say what's so simple, strict should not exist
>    because conversion should be strict by default.
> 
> The solution is to use "k" prefix and add convertors for more types.
> Enter
> 	kstrtoull()
> 	kstrtoll()
> 	kstrtoul()
> 	kstrtol()
> 	kstrtouint()
> 	kstrtoint()
> 
> 	kstrtou64()
> 	kstrtos64()
> 	kstrtou32()
> 	kstrtos32()
> 	kstrtou16()
> 	kstrtos16()
> 	kstrtou8()
> 	kstrtos8()
> 
> Include runtime testsuite (somewhat incomplete) as well.
> 
> strict_strto*() become deprecated, stubbed to kstrto*() and
> eventually will be removed altogether.

Note that they're deprecated but not marked __deprecated.  That's OK.

> Use kstrto*() in code today!

If you can stomach perl, please prepare a checkpatch patch which alerts
people to the new regime.

> Note: on some archs _kstrtoul() and _kstrtol() are left in tree, even if
>       they'll be unused at runtime. This is temporarily solution,
>       because I don't want to hardcode list of archs where these
>       functions aren't needed. Current solution with sizeof() and
>       __alignof__ at least always works.
> ---
> 
>  Let's merge this into mainline, so I can send individual patches
>  to subsystem maintainers. Whole tree is already converted locally.

Talk to us about the tighter checking.  There's a risk here that
current userspace which "works" will cease to work if we add additional
input checking.  Even if that userspace was broken and
just-happened-to-work, adding additional checks might cause disruption?



  reply	other threads:[~2011-03-01 23:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-26 12:47 Alexey Dobriyan
2011-03-01 23:24 ` Andrew Morton [this message]
2011-03-02  8:05   ` Alexey Dobriyan

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=20110301152455.995eb661.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adobriyan@gmail.com \
    --cc=arnd@arndb.de \
    --cc=geert@linux-m68k.org \
    --cc=jj@chaosbits.net \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®