[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <14e1e0ac3b2622f762c8f369afc9b1e9a84ca66b.camel@yandex.ru>
Date: Thu, 12 Feb 2026 14:13:16 +0300
From: Dmitry Antipov <dmantipov@...dex.ru>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, David Laight
<david.laight.linux@...il.com>, Kees Cook <kees@...nel.org>, "Darrick J .
Wong" <djwong@...nel.org>, linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 1/5] lib: fix _parse_integer_limit() to handle
overflow
On Tue, 2026-02-10 at 09:36 +0200, Andy Shevchenko wrote:
> I don't see how max_chars is used. With that said, I would rather see the usual
> way of expressing the condition in the for-loop:
>
> for (rv = 0; rv < max_chars; rv++, s++) {
This will break the loop (and so stop consuming characters) if KSTRTOX_OVERFLOW
bit is set.
> > + if (likely(res != ULLONG_MAX)) {
>
> Have you seen David's question about these checks?
> Maybe I missed your answer...
>
> > + if (unlikely(res & (~0ull << 60))) {
The first check may be dropped indeed (assuming check_mul_overflow(ULLONG_MAX, a, b)
and check_add_overflow(ULLONG_MAX, a, b) always signals an overflow).
Dmitry
Powered by blists - more mailing lists