Linux Hardening
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Carlos Maiolino <cem@kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	Kees Cook <kees@kernel.org>, Andy Shevchenko <andy@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-xfs@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] lib: introduce simple error-checking wrapper for memparse()
Date: Wed, 7 Jan 2026 21:24:01 +0200	[thread overview]
Message-ID: <aV6y0VTYbQKnHMqk@smile.fi.intel.com> (raw)
In-Reply-To: <aV6ye_vv_0N-SsLu@smile.fi.intel.com>

On Wed, Jan 07, 2026 at 09:22:39PM +0200, Andy Shevchenko wrote:
> On Wed, Jan 07, 2026 at 09:36:13PM +0300, Dmitry Antipov wrote:
> > Introduce 'memvalue()' which uses 'memparse()' to parse a string with
> > optional memory suffix into a number and returns this number or ULLONG_MAX
> > if the number is negative or an unrecognized character was encountered.
> 
> Reading the second patch in the series I do not think this one even needed. The
> problem in the original code is that
> 
> 	int *res, _res;
> 	...
> 	*res = _res << something;
> 
> This is a UB for _res < 0. So, the code should never handle negative numbers to
> begin with. That said the existing memparse() can be used directly.
> 
> If I missed something, it's because the commit message here is poorly written
> in regard to negative number parsing.

Also note, when do a series, make sure you have the same version for all
patches and the cover letter provided. You can use `b4` tool for that or
supply `git format-patch -v<X> --cover-letter ...`, where <X> is the desired
version number.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-01-07 19:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07 18:36 [PATCH] lib: introduce simple error-checking wrapper for memparse() Dmitry Antipov
2026-01-07 18:36 ` [PATCH v2] xfs: adjust handling of a few numerical mount options Dmitry Antipov
2026-01-07 18:48 ` [PATCH] lib: introduce simple error-checking wrapper for memparse() Andrew Morton
2026-01-08 13:14   ` Dmitry Antipov
2026-01-07 19:22 ` Andy Shevchenko
2026-01-07 19:24   ` Andy Shevchenko [this message]
2026-01-07 20:08 ` Kees Cook
2026-01-08  9:31   ` Christoph Hellwig

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=aV6y0VTYbQKnHMqk@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy@kernel.org \
    --cc=cem@kernel.org \
    --cc=dmantipov@yandex.ru \
    --cc=hch@infradead.org \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-xfs@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