s390/kasan: add support for mem= kernel parameter
authorVasily Gorbik <gor@linux.ibm.com>
Wed, 26 Sep 2018 11:46:26 +0000 (13:46 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 9 Oct 2018 09:21:35 +0000 (11:21 +0200)
Handle mem= kernel parameter in kasan to limit physical memory.

Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/mm/kasan_init.c

index 5b253247bc9723d6e133c7b170d3cdfff11fac7b..55982142b2b5bd5b91c73a7c4a0e4b39e1fec016 100644 (file)
@@ -268,6 +268,9 @@ void __init kasan_early_init(void)
        memsize = get_mem_detect_end();
        if (!memsize)
                kasan_early_panic("cannot detect physical memory size\n");
+       /* respect mem= cmdline parameter */
+       if (memory_end_set && memsize > memory_end)
+               memsize = memory_end;
        memsize = min(memsize, KASAN_SHADOW_START);
 
        if (IS_ENABLED(CONFIG_KASAN_S390_4_LEVEL_PAGING)) {