mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
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: Wed, 2 Mar 2011 10:05:38 +0200	[thread overview]
Message-ID: <20110302080538.GA4811@p183.telecom.by> (raw)
In-Reply-To: <20110301152455.995eb661.akpm@linux-foundation.org>

On Tue, Mar 01, 2011 at 03:24:55PM -0800, Andrew Morton wrote:
> On Sat, 26 Feb 2011 14:47:08 +0200
> Alexey Dobriyan <adobriyan@gmail.com> wrote:

> > Use kstrto*() in code today!
> 
> If you can stomach perl, please prepare a checkpatch patch which alerts
> people to the new regime.

Ehh, checkpatch was updated.
	scripts/checkpatch.pl        |    4

> >  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?

What strict_ family of functions errorneously does is to not check for
integer overflow in the result, so it'll happily eat a very long string
full of _valid_ digits: "0xffffffffffffffffffffffffffffffffffffffffffff"
will be converted to unsigned long even if it doesn't fit.
But people don't use such long strings, so the risk is low.

Also, kstrto*() allow to use leading '+' for positive values,
which is not restriction.

The rest should be the same.

      reply	other threads:[~2011-03-02  8:05 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
2011-03-02  8:05   ` Alexey Dobriyan [this message]

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=20110302080538.GA4811@p183.telecom.by \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --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®