Blob Blame History Raw
From: Vasily Gorbik <gor@linux.ibm.com>
Date: Fri, 16 Aug 2019 10:43:55 +0200
Subject: s390/startup: round down "mem" option to page boundary
Git-commit: 22a33c7e4ed6aae8c47de72461162021dad87473
Patch-mainline: v5.4-rc1
References: git-fixes

Make a usable value out of "mem" option once and for all. Kasan memory
allocator just takes memory_end or online memory size as allocation
base. If memory_end is not aligned paging structures allocated in kasan
end up unaligned as well. So this change fixes potential kasan crash
as well.

Fixes: 78333d1f908a ("s390/kasan: add support for mem= kernel parameter")
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 arch/s390/boot/ipl_parm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/s390/boot/ipl_parm.c
+++ b/arch/s390/boot/ipl_parm.c
@@ -220,7 +220,7 @@ void parse_boot_command_line(void)
 		args = next_arg(args, &param, &val);
 
 		if (!strcmp(param, "mem")) {
-			memory_end = memparse(val, NULL);
+			memory_end = round_down(memparse(val, NULL), PAGE_SIZE);
 			memory_end_set = 1;
 		}