public inbox for linux-hardening@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: Dmitry Antipov <dmantipov@yandex.ru>,
	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 v7 1/5] lib: fix _parse_integer_limit() to handle overflow
Date: Thu, 12 Feb 2026 16:45:34 +0200	[thread overview]
Message-ID: <aY3njs-gh9P0cEjj@smile.fi.intel.com> (raw)
In-Reply-To: <20260212143239.7039596a@pumpkin>

On Thu, Feb 12, 2026 at 02:32:39PM +0000, David Laight wrote:
> On Thu, 12 Feb 2026 15:41:59 +0200
> Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> > On Thu, Feb 12, 2026 at 03:56:24PM +0300, Dmitry Antipov wrote:

...

> > > +	for (rv = 0; max_chars--; rv++, s++) {  
> > 
> > Hmm... is max_chars being used inside for-loop body? I would rather use regular
> > pattern here:
> > 
> > 	for (rv = 0; rv < max_chars; rv++, s++) {
> > 
> > (just check that any integer / sign promotion doesn't change the logic).
> 
> The 'problem' is that the loop sets 'OVERFLOW' in rv.

Ah, true...

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-02-12 14:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 12:56 [PATCH v7 0/5] lib and lib/cmdline enhancements Dmitry Antipov
2026-02-12 12:56 ` [PATCH v7 1/5] lib: fix _parse_integer_limit() to handle overflow Dmitry Antipov
2026-02-12 13:41   ` Andy Shevchenko
2026-02-12 14:32     ` David Laight
2026-02-12 14:45       ` Andy Shevchenko [this message]
2026-02-12 13:51   ` David Laight
2026-02-12 12:56 ` [PATCH v7 2/5] lib: fix memparse() " Dmitry Antipov
2026-02-12 13:36   ` Andy Shevchenko
2026-02-12 12:56 ` [PATCH v7 3/5] lib: add more string to 64-bit integer conversion overflow tests Dmitry Antipov
2026-02-12 12:56 ` [PATCH v7 4/5] lib/cmdline_kunit: add test case for memparse() Dmitry Antipov
2026-02-12 12:56 ` [PATCH v7 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=aY3njs-gh9P0cEjj@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=david.laight.linux@gmail.com \
    --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