Commit 9fd745d4 authored by Xishi Qiu's avatar Xishi Qiu Committed by Linus Torvalds
Browse files

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: default avatarXishi Qiu <qiuxishi@huawei.com>
Reviewed-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Acked-by: default avatarTang Chen <tangchen@cn.fujitsu.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d031a157
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);