From 9fd745d450e7e2b0d2f1b386b886e7d568b64404 Mon Sep 17 00:00:00 2001 From: Xishi Qiu Date: Thu, 5 Nov 2015 18:48:11 -0800 Subject: mm: fix overflow in find_zone_movable_pfns_for_nodes() If the user set "movablecore=xx" to a large number, corepages will overflow. Fix the problem. Signed-off-by: Xishi Qiu Reviewed-by: Yasuaki Ishimatsu Acked-by: Tang Chen Acked-by: David Rientjes Cc: Mel Gorman Cc: Tang Chen Cc: Zhang Yanfei Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/page_alloc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'mm/page_alloc.c') diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c60605df9b48..4aed338fc535 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5666,6 +5666,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) */ required_movablecore = roundup(required_movablecore, MAX_ORDER_NR_PAGES); + required_movablecore = min(totalpages, required_movablecore); corepages = totalpages - required_movablecore; required_kernelcore = max(required_kernelcore, corepages); -- cgit v1.2.3