From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Kees Cook <kees@kernel.org>,
"Darrick J . Wong" <djwong@kernel.org>,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/5] lib: fix memparse() to handle overflow
Date: Thu, 5 Feb 2026 18:05:07 +0200 [thread overview]
Message-ID: <aYS_s0lleaOWeYud@smile.fi.intel.com> (raw)
In-Reply-To: <bd627279346a8eb8096371c899325ccfc6fd07d7.camel@yandex.ru>
On Thu, Feb 05, 2026 at 12:17:16PM +0300, Dmitry Antipov wrote:
> On Wed, 2026-02-04 at 16:42 +0200, Andy Shevchenko wrote:
> > On Wed, Feb 04, 2026 at 04:57:14PM +0300, Dmitry Antipov wrote:
> > > Since '_parse_integer_limit()' (and so 'simple_strtoull()') is now
> > > capable to handle overflow, adjust 'memparse()' to handle overflow
> > > (denoted by ULLONG_MAX) returned from 'simple_strtoull()'. Also
> > > use 'check_shl_overflow()' to catch an overflow possibly caused
> > > by processing size suffix and denote it with ULLONG_MAX as well.
> >
> > Do we have already test cases to cover this?
>
> In
>
> static const struct cmdline_test_memparse_entry testdata[] = {
> ...
> { "1111111111111111111T", "", ULLONG_MAX },
> ...
> };
>
> the whole string is valid and so should be recognized by memparse(). Next,
> 1111111111111111111 fits unsigned long long but 1111111111111111111 << 40
> is too large and should be catched by check_shl_overflow().
But if there is a case already, how does it pass?
My understanding is that if we modify the code behaviour the test cases should
be amended at the same time. I guess I missed something here.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-02-05 16:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 13:57 [PATCH v5 0/5] lib and lib/cmdline enhancements Dmitry Antipov
2026-02-04 13:57 ` [PATCH v5 1/5] lib: fix _parse_integer_limit() to handle overflow Dmitry Antipov
2026-02-04 14:31 ` Andy Shevchenko
2026-02-05 9:04 ` Dmitry Antipov
2026-02-05 16:03 ` Andy Shevchenko
2026-02-05 22:15 ` David Laight
2026-02-06 7:42 ` Andy Shevchenko
2026-02-06 9:53 ` Dmitry Antipov
2026-02-06 10:11 ` Andy Shevchenko
2026-02-04 13:57 ` [PATCH v5 2/5] lib: fix memparse() " Dmitry Antipov
2026-02-04 14:42 ` Andy Shevchenko
2026-02-05 9:17 ` Dmitry Antipov
2026-02-05 16:05 ` Andy Shevchenko [this message]
2026-02-04 13:57 ` [PATCH v5 3/5] lib: add more string to 64-bit integer conversion overflow tests Dmitry Antipov
2026-02-04 13:57 ` [PATCH v5 4/5] lib/cmdline_kunit: add test case for memparse() Dmitry Antipov
2026-02-04 13:57 ` [PATCH v5 5/5] lib/cmdline: adjust a few comments to fix kernel-doc -Wreturn warnings Dmitry Antipov
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=aYS_s0lleaOWeYud@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=akpm@linux-foundation.org \
--cc=djwong@kernel.org \
--cc=dmantipov@yandex.ru \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox