]> Gentwo Git Trees - linux/.git/commit
mm/page_alloc: reject unreasonable folio/compound page sizes in alloc_contig_range_no...
authorDavid Hildenbrand <david@redhat.com>
Mon, 1 Sep 2025 15:03:27 +0000 (17:03 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 21 Sep 2025 21:22:02 +0000 (14:22 -0700)
commit0bf2edf041dcb0b304a8dbda8c699771d5a245d2
tree27a7df024dce6041d2fd479319c2bee6b348a7ba
parent3b864c8f557a52c142905575157c69be20899f09
mm/page_alloc: reject unreasonable folio/compound page sizes in alloc_contig_range_noprof()

Let's reject them early, which in turn makes folio_alloc_gigantic() reject
them properly.

To avoid converting from order to nr_pages, let's just add MAX_FOLIO_ORDER
and calculate MAX_FOLIO_NR_PAGES based on that.

While at it, let's just make the order a "const unsigned order".

Link: https://lkml.kernel.org/r/20250901150359.867252-7-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Acked-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/mm.h
mm/page_alloc.c