From: Sven Schnelle Date: Fri, 27 Aug 2021 06:36:06 +0000 (+0200) Subject: s390: add kmemleak annotation in stack_alloc() X-Git-Tag: v5.15~311^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=436fc4feeabbf103d78d50a8e091b3aac28cc37f;p=platform%2Fkernel%2Flinux-starfive.git s390: add kmemleak annotation in stack_alloc() kmemleak with enabled auto scanning reports that our stack allocation is lost. This is because we're saving the pointer + STACK_INIT_OFFSET to lowcore. When kmemleak now scans the objects, it thinks that this one is lost because it can't find a corresponding pointer. Reported-by: Marc Hartmayer Signed-off-by: Sven Schnelle Tested-by: Marc Hartmayer Signed-off-by: Heiko Carstens --- diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index fe14beb..1b83162 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -356,9 +357,12 @@ void *restart_stack; unsigned long stack_alloc(void) { #ifdef CONFIG_VMAP_STACK - return (unsigned long)__vmalloc_node(THREAD_SIZE, THREAD_SIZE, - THREADINFO_GFP, NUMA_NO_NODE, - __builtin_return_address(0)); + void *ret; + + ret = __vmalloc_node(THREAD_SIZE, THREAD_SIZE, THREADINFO_GFP, + NUMA_NO_NODE, __builtin_return_address(0)); + kmemleak_not_leak(ret); + return (unsigned long)ret; #else return __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER); #endif