[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <172348819834.2826487.9112203772355447388.b4-ty@kernel.org>
Date: Mon, 12 Aug 2024 11:43:20 -0700
From: Kees Cook <kees@...nel.org>
To: Andy Shevchenko <andy@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Justin Stitt <justinstitt@...gle.com>
Cc: Kees Cook <kees@...nel.org>,
linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] lib/string_helpers: rework overflow-dependent code
On Thu, 08 Aug 2024 14:43:56 -0700, Justin Stitt wrote:
> When @size is 0, the desired behavior is to allow unlimited bytes to be
> parsed. Currently, this relies on some intentional arithmetic overflow
> where --size gives us SIZE_MAX when size is 0.
>
> Explicitly spell out the desired behavior without relying on intentional
> overflow/underflow.
>
> [...]
Since we can't have allocations larger than INT_MAX, SIZE_MAX is
sufficiently large for this use-case, and the "off by one" introduce
here isn't meaningful. I prefer the improved readability and lack of
wrapping pre-decrement.
Applied to for-next/hardening, thanks!
[1/1] lib/string_helpers: rework overflow-dependent code
https://git.kernel.org/kees/c/5d6b91b74ccd
Take care,
--
Kees Cook
Powered by blists - more mailing lists