Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4f3eb5f authored by James Yang's avatar James Yang Committed by Benjamin Herrenschmidt
Browse files

powerpc/mm/hugetlb: Sanity check gigantic hugepage count



Limit the number of gigantic hugepages specified by the
hugepages= parameter to MAX_NUMBER_GPAGES.

Signed-off-by: default avatarJames Yang <James.Yang@freescale.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 0de3b56b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -355,6 +355,13 @@ static int __init do_gpage_early_setup(char *param, char *val,
		if (size != 0) {
			if (sscanf(val, "%lu", &npages) <= 0)
				npages = 0;
			if (npages > MAX_NUMBER_GPAGES) {
				pr_warn("MMU: %lu pages requested for page "
					"size %llu KB, limiting to "
					__stringify(MAX_NUMBER_GPAGES) "\n",
					npages, size / 1024);
				npages = MAX_NUMBER_GPAGES;
			}
			gpage_npages[shift_to_mmu_psize(__ffs(size))] = npages;
			size = 0;
		}