[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWDkBUss5o0FerOv@smile.fi.intel.com>
Date: Fri, 9 Jan 2026 13:18:29 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Dmitry Antipov <dmantipov@...dex.ru>
Cc: Carlos Maiolino <cem@...nel.org>, Christoph Hellwig <hch@...radead.org>,
Kees Cook <kees@...nel.org>, Andy Shevchenko <andy@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-xfs@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v3 1/2] lib: introduce simple error-checking wrapper for
memparse()
On Fri, Jan 09, 2026 at 02:05:41PM +0300, Dmitry Antipov wrote:
> On Thu, 2026-01-08 at 22:10 +0200, Andy Shevchenko wrote:
>
> > Hmm... Why not -ERANGE (IIRC this what kstrto*() returns when it doesn't match
> > the given range).
>
> Well, I've always treated -ERANGE closer to formal math, i.e. "return -ERANGE
> if X is not in [A:B)", rather than using it to denote something which makes
> no practical sense in some particular context, like negative amount of memory
> or negative string length.
Well, I'm not talking about your preferences, I'm talking about the change you
made. First of all,
if (rv & KSTRTOX_OVERFLOW)
return -ERANGE;
is in the original kstrtox implementation that suggests that the code is
already established for the purpose. Second, the bigger issue, the two
semantically different error paths return the same error code when it can
be easily avoided.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists