Re: [PATCH] slab: Saturate to SIZE_MAX for allocation size overflows

Harry Yoo
2026-02-25T02:36:31Z

On Tue, Feb 24, 2026 at 05:40:02PM -0800, Kees Cook wrote:
> Instead of silently returning NULL on size overflows from array
> allocations, saturate the request to SIZE_MAX so the error will be
> surfaced to the allocator (and still return NULL).
>
> Suggested-by: Vlastimil Babka <vbabka@suse.cz>
> Link: https://lore.kernel.org/lkml/a144cd1e-8bfc-4380-8f1b-071db0af0b2c@suse.cz/
> Signed-off-by: Kees Cook <kees@kernel.org>
> ---

Yes, since it's larger than order-1, it'll be passed to
the page allocator and will hit the order > MAX_PAGE_ORDER warning in
__alloc_frozen_pages_noprof().

Looks good to me,
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>

--
Cheers,
Harry / Hyeonggon