s390/startup: round down "mem" option to page boundary
authorVasily Gorbik <gor@linux.ibm.com>
Fri, 16 Aug 2019 08:43:55 +0000 (10:43 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 21 Aug 2019 10:58:53 +0000 (12:58 +0200)
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>
arch/s390/boot/ipl_parm.c

index 449d26a42f3f1f73497af2134393f3b778d9cc8b..4a052a844f9be43a542a74aeb0ec6305d517fb9e 100644 (file)
@@ -224,7 +224,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;
                }