All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	Alexey Dobriyan <adobriyan@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: incoming
Date: Wed, 9 Sep 2015 16:23:17 -0700	[thread overview]
Message-ID: <CA+55aFxN7ebRPpayOQSznjJobz1UVQRQ5rMAKjxGvc3vW6fNYg@mail.gmail.com> (raw)
In-Reply-To: <20150909153424.3feb1c403a841ab97b2d98ab@linux-foundation.org>

On Wed, Sep 9, 2015 at 3:34 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> Subject: lib/: add parse_integer() (replacement for simple_strto*())
> Subject: parse_integer: add runtime testsuite
> Subject: parse-integer: rewrite kstrto*()
> Subject: parse_integer: add checkpatch.pl notice
> Subject: parse_integer: convert scanf()
> Subject: scanf: fix type range overflow
> Subject: parse_integer: convert lib/
> Subject: parse_integer: convert mm/
> Subject: parse_integer: convert fs/
> Subject: parse_integer: convert fs/cachefiles/
> Subject: parse_integer: convert ext2, ext4
> Subject: parse_integer: convert fs/ocfs2/
> Subject: parse_integer: convert fs/9p/
> Subject: parse_integer: convert fs/exofs/

No.

I'm not taking yet another broken "deprecate old interface, replace it
with new-and-improved one, and screw things up in the process".

The whole "kstrto*()" thing was a mistake. We had real bugs brought in
by the conversion to the "better" interface. The "even betterer" new
parse_integer() interface actually looks lik ea real improvement, and
talks about some of the brokenness of the old code, and I was really
wanting to like it, but then I saw the conversions.

The VERY FIRST conversion patch I looked at was buggy. That makes me
angry. The whole *AND*ONLY* point of this whole thing was to get rid
of bugs, and be a obviously safe interface, and then the first
conversion patch proves it wrong.

Let me show you:

        if (isdigit(*str)) {
-               io_tlb_nslabs = simple_strtoul(str, &str, 0);
+               str += parse_integer(str, 0, &io_tlb_nslabs);

and obviously nobody spent even a *second* asking themselves "what if
parse_integer returns an error".

The old code didn't fail catastrophically in the error case. The new one does.

And yes, parse_integer() really can return an error, even despite that
"isdigit(*str)" check. Think about it. Or just read the source code.

I really am very tired indeed of these "trivially obvious
improvements" that are buggy and actually introduce whole new ways to
write buggy code. Yes, the old code could miss an error. But the old
code wouldn't then create invalid pointers like the new code does.

I'm not thrilled about going through the rest of this sequence,
looking for other gotcha's. But I am *really* really tired of this
idiotic "let's make up a new interface that gets things right" and
then absolutely doesn't get it right at all. This is not just an issue
for number parseing - we had similar issues with the completely
moronic and misdesigned crap called "strlcpy()", which was introduced
for similar reasons, and also caused nasty bugs where the old code was
actually correct, and the "converted to better and safer interfaces"
code was actually buggy.

Mixing the error handling and the string update was a mistake.
Although *not* mixing it causes its own set of problems.

But whatever the final resolution to this is, I am *not* taking this
series. No way, no how. I liked the automatic type-based templating it
does, but I *don't* like the breakage that seems to be inevitable in
any large-scale conversion from a previously used historical
interface. People who implement new and improved interfaces always
seem to get that wrong.

              Linus

       reply	other threads:[~2015-09-09 23:23 UTC|newest]

Thread overview: 325+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150909153424.3feb1c403a841ab97b2d98ab@linux-foundation.org>
2015-09-09 23:23 ` Linus Torvalds [this message]
2015-09-10  6:47   ` incoming Rasmus Villemoes
2022-04-27 19:41 incoming Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2022-04-21 23:35 incoming Andrew Morton
2022-04-15  2:12 incoming Andrew Morton
2022-04-08 20:08 incoming Andrew Morton
2022-04-01 18:27 incoming Andrew Morton
2022-04-01 18:20 incoming Andrew Morton
2022-04-01 18:27 ` incoming Andrew Morton
2022-03-25  1:07 incoming Andrew Morton
2022-03-23 23:04 incoming Andrew Morton
2022-03-22 21:38 incoming Andrew Morton
2022-03-16 23:14 incoming Andrew Morton
2022-03-05  4:28 incoming Andrew Morton
2022-02-26  3:10 incoming Andrew Morton
2022-02-12  0:27 incoming Andrew Morton
2022-02-12  2:02 ` incoming Linus Torvalds
2022-02-12  5:24   ` incoming Andrew Morton
2022-02-04  4:48 incoming Andrew Morton
2022-01-29 21:40 incoming Andrew Morton
2022-01-29  2:13 incoming Andrew Morton
2022-01-29  4:25 ` incoming Matthew Wilcox
2022-01-29  6:23   ` incoming Andrew Morton
2022-01-22  6:10 incoming Andrew Morton
2022-01-20  2:07 incoming Andrew Morton
2022-01-14 22:02 incoming Andrew Morton
2021-12-31  4:12 incoming Andrew Morton
2021-12-25  5:11 incoming Andrew Morton
2021-12-10 22:45 incoming Andrew Morton
2021-11-20  0:42 incoming Andrew Morton
2021-11-11  4:32 incoming Andrew Morton
2021-11-09  2:30 incoming Andrew Morton
2021-11-05 20:34 incoming Andrew Morton
2021-10-28 21:35 incoming Andrew Morton
2021-10-18 22:14 incoming Andrew Morton
2021-09-24 22:42 incoming Andrew Morton
2021-09-10  3:09 incoming Andrew Morton
2021-09-10 17:11 ` incoming Kees Cook
2021-09-10 20:13   ` incoming Kees Cook
2021-09-09  1:08 incoming Andrew Morton
2021-09-08 22:17 incoming Andrew Morton
2021-09-08  2:52 incoming Andrew Morton
2021-09-08  8:57 ` incoming Vlastimil Babka
2021-09-02 21:48 incoming Andrew Morton
2021-09-02 21:49 ` incoming Andrew Morton
2021-08-25 19:17 incoming Andrew Morton
2021-08-20  2:03 incoming Andrew Morton
2021-08-13 23:53 incoming Andrew Morton
2021-07-29 21:52 incoming Andrew Morton
2021-07-23 22:49 incoming Andrew Morton
2021-07-15  4:26 incoming Andrew Morton
2021-07-08  0:59 incoming Andrew Morton
2021-07-01  1:46 incoming Andrew Morton
2021-07-03  0:28 ` incoming Linus Torvalds
2021-07-03  1:06   ` incoming Linus Torvalds
2021-06-29  2:32 incoming Andrew Morton
2021-06-25  1:38 incoming Andrew Morton
2021-06-16  1:22 incoming Andrew Morton
2021-06-05  3:00 incoming Andrew Morton
2021-05-23  0:41 incoming Andrew Morton
2021-05-15  0:26 incoming Andrew Morton
2021-05-07  1:01 incoming Andrew Morton
2021-05-07  7:12 ` incoming Linus Torvalds
2021-05-05  1:32 incoming Andrew Morton
2021-05-05  1:47 ` incoming Linus Torvalds
2021-05-05  3:16   ` incoming Andrew Morton
2021-05-05 17:10     ` incoming Linus Torvalds
2021-05-05 17:10       ` incoming Linus Torvalds
2021-05-05 17:44       ` incoming Andrew Morton
2021-05-06  3:19         ` incoming Anshuman Khandual
2021-04-30  5:52 incoming Andrew Morton
2021-04-23 21:28 incoming Andrew Morton
2021-04-16 22:45 incoming Andrew Morton
2021-04-09 20:26 incoming Andrew Morton
2021-03-25  4:36 incoming Andrew Morton
2021-03-13  5:06 incoming Andrew Morton
2021-02-26  1:14 incoming Andrew Morton
2021-02-26 17:55 ` incoming Linus Torvalds
2021-02-26 19:16   ` incoming Andrew Morton
2021-02-24 19:58 incoming Andrew Morton
2021-02-24 21:30 ` incoming Linus Torvalds
2021-02-24 21:37   ` incoming Linus Torvalds
2021-02-24 21:37     ` incoming Linus Torvalds
2021-02-25  8:53     ` incoming Arnd Bergmann
2021-02-25  8:53       ` incoming Arnd Bergmann
2021-02-25  9:12       ` incoming Andrey Ryabinin
2021-02-25  9:12         ` incoming Andrey Ryabinin
2021-02-25 11:07         ` incoming Walter Wu
2021-02-13  4:52 incoming Andrew Morton
2021-02-09 21:41 incoming Andrew Morton
2021-02-10 19:30 ` incoming Linus Torvalds
2021-02-05  2:31 incoming Andrew Morton
2021-01-24  5:00 incoming Andrew Morton
2021-01-12 23:48 incoming Andrew Morton
2021-01-15 23:32 ` incoming Linus Torvalds
2020-12-29 23:13 incoming Andrew Morton
2020-12-22 19:58 incoming Andrew Morton
2020-12-22 21:43 ` incoming Linus Torvalds
2020-12-18 22:00 incoming Andrew Morton
2020-12-16  4:41 incoming Andrew Morton
2020-12-15 20:32 incoming Andrew Morton
2020-12-15 21:00 ` incoming Linus Torvalds
2020-12-15 22:48 ` incoming Linus Torvalds
2020-12-15 22:49   ` incoming Linus Torvalds
2020-12-15 22:55     ` incoming Andrew Morton
2020-12-15  3:02 incoming Andrew Morton
2020-12-15  3:25 ` incoming Linus Torvalds
2020-12-15  3:25   ` incoming Linus Torvalds
2020-12-15  3:30   ` incoming Linus Torvalds
2020-12-15  3:30     ` incoming Linus Torvalds
2020-12-15 14:04     ` incoming Konstantin Ryabitsev
2020-12-11 21:35 incoming Andrew Morton
2020-12-06  6:14 incoming Andrew Morton
2020-11-22  6:16 incoming Andrew Morton
2020-11-14  6:51 incoming Andrew Morton
2020-11-02  1:06 incoming Andrew Morton
2020-10-17 23:13 incoming Andrew Morton
2020-10-16  2:40 incoming Andrew Morton
2020-10-16  3:03 ` incoming Andrew Morton
2020-10-13 23:46 incoming Andrew Morton
2020-10-11  6:15 incoming Andrew Morton
2020-10-03  5:20 incoming Andrew Morton
2020-09-26  4:17 incoming Andrew Morton
2020-09-19  4:19 incoming Andrew Morton
2020-09-04 23:34 incoming Andrew Morton
2020-08-21  0:41 incoming Andrew Morton
2020-08-15  0:29 incoming Andrew Morton
2020-08-12  1:29 incoming Andrew Morton
2020-08-07  6:16 incoming Andrew Morton
2020-07-24  4:14 incoming Andrew Morton
2020-07-03 22:14 incoming Andrew Morton
2020-06-26  3:28 incoming Andrew Morton
2020-06-26  6:51 ` incoming Linus Torvalds
2020-06-26  7:31   ` incoming Linus Torvalds
2020-06-26 17:39   ` incoming Konstantin Ryabitsev
2020-06-26 17:40     ` incoming Konstantin Ryabitsev
2020-06-12  0:30 incoming Andrew Morton
2020-06-11  1:40 incoming Andrew Morton
2020-06-09  4:29 incoming Andrew Morton
2020-06-09 16:58 ` incoming Linus Torvalds
2020-06-08  4:35 incoming Andrew Morton
2020-06-04 23:45 incoming Andrew Morton
2020-06-03 22:55 incoming Andrew Morton
2020-06-02 20:09 incoming Andrew Morton
2020-06-02  4:44 incoming Andrew Morton
2020-06-02 20:08 ` incoming Andrew Morton
2020-06-02 20:45   ` incoming Linus Torvalds
2020-06-02 21:38     ` incoming Andrew Morton
2020-06-02 22:18       ` incoming Linus Torvalds
2020-05-28  5:20 incoming Andrew Morton
2020-05-28 20:10 ` incoming Linus Torvalds
2020-05-29 20:31   ` incoming Andrew Morton
2020-05-29 20:38     ` incoming Linus Torvalds
2020-05-29 21:12       ` incoming Andrew Morton
2020-05-29 21:20         ` incoming Linus Torvalds
2020-05-23  5:22 incoming Andrew Morton
2020-05-14  0:50 incoming Andrew Morton
2020-05-08  1:35 incoming Andrew Morton
2020-04-21  1:13 incoming Andrew Morton
2020-04-12  7:41 incoming Andrew Morton
2020-04-10 21:30 incoming Andrew Morton
2020-04-07  3:02 incoming Andrew Morton
2020-04-02  4:01 incoming Andrew Morton
2020-03-29  2:14 incoming Andrew Morton
2020-03-22  1:19 incoming Andrew Morton
2020-03-06  6:27 incoming Andrew Morton
2020-02-21  4:00 incoming Andrew Morton
2020-02-21  4:03 ` incoming Andrew Morton
2020-02-21 18:21 ` incoming Linus Torvalds
2020-02-21 18:32   ` incoming Konstantin Ryabitsev
2020-02-27  9:59     ` incoming Vlastimil Babka
2020-02-21 19:33   ` incoming Linus Torvalds
2020-02-04  1:33 incoming Andrew Morton
2020-02-04  2:27 ` incoming Linus Torvalds
2020-02-04  2:46   ` incoming Andrew Morton
2020-02-04  3:11     ` incoming Linus Torvalds
2020-01-31  6:10 incoming Andrew Morton
2020-01-14  0:28 incoming Andrew Morton
2020-01-04 20:55 incoming Andrew Morton
2019-12-18  4:50 incoming Andrew Morton
2019-12-05  0:48 incoming Andrew Morton
2019-12-01  1:47 incoming Andrew Morton
2019-12-01  5:17 ` incoming James Bottomley
2019-12-01 21:07 ` incoming Linus Torvalds
2019-12-02  8:21   ` incoming Steven Price
2019-11-22  1:53 incoming Andrew Morton
2019-11-16  1:34 incoming Andrew Morton
2019-11-06  5:16 incoming Andrew Morton
2019-10-19  3:19 incoming Andrew Morton
2019-10-14 21:11 incoming Andrew Morton
2019-10-07  0:57 incoming Andrew Morton
2019-09-25 23:45 incoming Andrew Morton
2019-09-23 22:31 incoming Andrew Morton
2019-09-24  0:55 ` incoming Linus Torvalds
2019-09-24  4:31   ` incoming Andrew Morton
2019-09-24  7:48     ` incoming Michal Hocko
2019-09-24 15:34       ` incoming Linus Torvalds
2019-09-25  6:36         ` incoming Michal Hocko
2019-09-24 19:55       ` incoming Vlastimil Babka
2019-08-30 23:04 incoming Andrew Morton
2019-08-25  0:54 incoming Andrew Morton
     [not found] <20190718155613.546f9056bbb57f486ab64307@linux-foundation.org>
2019-07-19 10:42 ` incoming Vlastimil Babka
     [not found] <20190716162536.bb52b8f34a8ecf5331a86a42@linux-foundation.org>
2019-07-17  8:47 ` incoming Vlastimil Babka
2019-07-17  8:57   ` incoming Bhaskar Chowdhury
2019-07-17 16:13   ` incoming Linus Torvalds
2019-07-17 16:13     ` incoming Linus Torvalds
2019-07-17 17:09     ` incoming Christian Brauner
2019-07-17 18:13     ` incoming Vlastimil Babka
2018-02-06 23:34 incoming Andrew Morton
2018-02-01  0:13 incoming Andrew Morton
2018-02-01  0:25 ` incoming Andrew Morton
2018-01-19  0:33 incoming Andrew Morton
2018-01-13  0:52 incoming Andrew Morton
2018-01-05  0:17 incoming Andrew Morton
2017-12-14 23:32 incoming Andrew Morton
2017-11-30  0:09 incoming Andrew Morton
2017-11-17 23:25 incoming Andrew Morton
2017-11-16  1:29 incoming Andrew Morton
2017-11-09 21:38 incoming Andrew Morton
2017-11-02 22:59 incoming Andrew Morton
2017-10-13 22:57 incoming Andrew Morton
2017-10-03 23:14 incoming Andrew Morton
2017-09-13 23:28 incoming Andrew Morton
2017-09-08 23:10 incoming Andrew Morton
     [not found] ` <CA+55aFwRXB5_kSuN7o+tqN6Eft6w5oZuLG3B8Rns=0ZZa2ihgA@mail.gmail.com>
     [not found]   ` <CA+55aFw+z3HDT4s1C41j=d5_0QTSu8NLSSpnk_jxZ39w34xgnA@mail.gmail.com>
2017-09-09 18:09     ` incoming Andrew Morton
2017-09-06 23:17 incoming Andrew Morton
2017-08-31 23:15 incoming Andrew Morton
2017-08-25 22:55 incoming Andrew Morton
2017-08-18 22:15 incoming Andrew Morton
2017-08-10 22:23 incoming Andrew Morton
2017-08-02 20:31 incoming Andrew Morton
2017-07-14 21:46 incoming Andrew Morton
2017-07-12 21:32 incoming Andrew Morton
2017-07-10 22:46 incoming Andrew Morton
2017-07-06 22:34 incoming Andrew Morton
2017-06-23 22:08 incoming Andrew Morton
2017-06-16 21:02 incoming Andrew Morton
2017-06-02 21:45 incoming Andrew Morton
2017-05-12 22:45 incoming Andrew Morton
2017-05-08 22:53 incoming Andrew Morton
2017-05-03 21:50 incoming Andrew Morton
2017-04-20 21:37 incoming Andrew Morton
2017-04-13 21:56 incoming Andrew Morton
2017-04-07 23:04 incoming Andrew Morton
2017-03-31 22:11 incoming Andrew Morton
2017-03-16 23:40 incoming Andrew Morton
2017-03-10  0:15 incoming Andrew Morton
2017-02-27 22:25 incoming Andrew Morton
2017-02-24 22:55 incoming Andrew Morton
2017-02-22 23:38 incoming Andrew Morton
2017-02-18 11:42 incoming Andrew Morton
2017-02-08 22:30 incoming Andrew Morton
2017-01-24 23:17 incoming Andrew Morton
2017-01-11  0:57 incoming Andrew Morton
2016-12-20  0:22 incoming Andrew Morton
2016-12-14 23:04 incoming Andrew Morton
2016-12-13  0:40 incoming Andrew Morton
2016-12-07 22:44 incoming Andrew Morton
2016-12-03  1:26 incoming Andrew Morton
2016-11-30 23:53 incoming Andrew Morton
2016-11-10 18:45 incoming Andrew Morton
2016-10-11 20:49 incoming Andrew Morton
2016-10-07 23:53 incoming Andrew Morton
2016-09-30 22:11 incoming Andrew Morton
2016-09-28 22:22 incoming Andrew Morton
2016-09-19 21:43 incoming Andrew Morton
2016-09-01 23:14 incoming Andrew Morton
2016-08-25 22:16 incoming Andrew Morton
2016-08-11 22:32 incoming Andrew Morton
2016-08-04 22:31 incoming Andrew Morton
2016-08-03 20:45 incoming Andrew Morton
2016-08-02 21:01 incoming Andrew Morton
2016-07-28 22:42 incoming Andrew Morton
2016-07-26 22:16 incoming Andrew Morton
2016-07-20 22:44 incoming Andrew Morton
2016-07-14 19:06 incoming Andrew Morton
2016-06-24 21:48 incoming Andrew Morton
2016-06-08 22:33 incoming Andrew Morton
2016-06-03 21:51 incoming Andrew Morton
2016-05-27 21:26 incoming Andrew Morton
2016-05-26 22:15 incoming Andrew Morton
2016-05-23 23:21 incoming Andrew Morton
2016-05-20 23:55 incoming Andrew Morton
2016-05-20  0:07 incoming Andrew Morton
2016-05-12 22:41 incoming Andrew Morton
2016-05-09 23:28 incoming Andrew Morton
2016-05-05 23:21 incoming Andrew Morton
2007-05-02 22:02 incoming Andrew Morton
2007-05-02 22:02 ` incoming Andrew Morton
2007-05-02 22:31 ` incoming Benjamin Herrenschmidt
2007-05-02 22:31   ` incoming Benjamin Herrenschmidt
2007-05-03  7:55 ` incoming Russell King
2007-05-03  7:55   ` incoming Russell King
2007-05-03  8:05   ` incoming Andrew Morton
2007-05-03  8:05     ` incoming Andrew Morton
2007-05-04 13:37 ` incoming Greg KH
2007-05-04 13:37   ` incoming Greg KH
2007-05-04 16:14   ` incoming Andrew Morton
2007-05-04 16:14     ` incoming Andrew Morton
2007-05-04 17:02     ` incoming Greg KH
2007-05-04 17:02       ` incoming Greg KH
2007-05-04 18:57     ` incoming Roland McGrath
2007-05-04 18:57       ` incoming Roland McGrath
2007-05-04 19:24       ` incoming Greg KH
2007-05-04 19:24         ` incoming Greg KH
2007-05-04 19:29         ` incoming Roland McGrath
2007-05-04 19:29           ` incoming Roland McGrath
2006-10-20 21:39 incoming Andrew Morton
2006-10-20 22:31 ` incoming Alan Cox
2005-04-12 10:23 incoming Andrew Morton
2005-04-12 11:02 ` incoming David Vrabel
2005-04-12 11:10   ` incoming Andrew Morton
2005-04-12 11:33     ` incoming David Vrabel
2005-04-12 18:31     ` incoming Matthias Urlichs
2005-04-16  8:59     ` incoming Paul Jackson
2005-04-12 14:38 ` incoming Chris Friesen
2005-04-12 20:55 ` incoming Russell King
2005-04-12 21:08   ` incoming Andrew Morton
2005-04-12 21:12     ` incoming Russell King
2005-04-14 11:48 ` incoming Geert Uytterhoeven
2005-04-14 11:57   ` incoming Paulo Marques
2005-04-14 15:38   ` incoming Lee Revell
2005-04-16  9:03     ` incoming Paul Jackson
2004-11-11  0:02 incoming Andrew Morton
2004-10-28  7:19 incoming Andrew Morton

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=CA+55aFxN7ebRPpayOQSznjJobz1UVQRQ5rMAKjxGvc3vW6fNYg@mail.gmail.com \
    --to=torvalds@linux-foundation.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.