mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Armaan Sandhu <armaan.sandhu0504@gmail.com>
Cc: LZ <lzsx618@gmail.com>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] lib/cmdline: fix get_options() count and overflow with large ranges
Date: Wed, 7 Oct 2026 17:08:23 -0700	[thread overview]
Message-ID: <20261007170823.ecfc71e75b3bc416713d5a1e@linux-foundation.org> (raw)
In-Reply-To: <CANVJMCFQr9r5-_z3MKkX3G56DWBQTBK8XHW8+YBmme4=F+Cb5A@mail.gmail.com>

On Wed, 7 Oct 2026 19:50:38 -0400 Armaan Sandhu <armaan.sandhu0504@gmail.com> wrote:

> On Wed, 7 Oct 2026 Andrew Morton <akpm@linux-foundation.org> wrote:
> > Armaan, can you please check the regression tests, see if there's
> > anything to be incorporated into yours?
> 
> Leizhen's two cases pass with my patch. "0-2147483647" in validation
> mode is already in my table, but "1,0-2147483647" isn't, and it is worth
> adding since it hits the overflow guard with a value already parsed, which
> none of my cases do. It's one extra row:
> 
> { "1,0-2147483647", { 3, 1, 0, 1, }, 1, },
> 
> Earlier you asked what would change in a v2. Nothing else, so I can
> send a v2 with that row, or you can fold it in, whichever is easier.
> 
> Thanks Leizhen for the review.

Yes, thanks both.  I queued Armaan's patch and appended this:

--- a/lib/tests/cmdline_kunit.c~lib-cmdline-fix-get_options-count-and-overflow-with-large-ranges-fix
+++ a/lib/tests/cmdline_kunit.c
@@ -151,6 +151,7 @@ static const struct {
 	{ "0-2147483647",  { 3, 0, 1, 2, },    0,          },
 	{ "-5-2147483647", { 3, -5, -4, -3, }, 0,          },
 	{ "2147483647--5", { 0, 2147483647, }, 0,          },
+	{ "1,0-2147483647", { 3, 1, 0, 1, },   1, },
 };
 
 static void cmdline_test_range_overflow(struct kunit *test)
_


      parent reply	other threads:[~2026-10-08  0:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 21:39 Armaan Sandhu
2026-10-07 22:00 ` Andrew Morton
     [not found]   ` <CAGD6qbSfTmHq7Y_jM7-QS26at=w6OQwfOZjCU8n4PnnFmqgDNg@mail.gmail.com>
2026-10-07 23:08     ` Andrew Morton
     [not found]       ` <CAGD6qbRJFPX9dYHokumQat3q0AZiG7bgC3hr8rMpCc_BUS6f2g@mail.gmail.com>
     [not found]         ` <CANVJMCFQr9r5-_z3MKkX3G56DWBQTBK8XHW8+YBmme4=F+Cb5A@mail.gmail.com>
2026-10-08  0:08           ` Andrew Morton [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=20261007170823.ecfc71e75b3bc416713d5a1e@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=armaan.sandhu0504@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lzsx618@gmail.com \
    --cc=stable@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®