Re: [PATCH] arm64/efi: Fix kmemleak false positive in arm64_efi_rt_init()

From: Catalin Marinas
Date: Thu Jun 13 2024 - 13:19:49 EST


On Thu, Jun 13, 2024 at 12:20:31PM -0400, Waiman Long wrote:
> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> index 4a92096db34e..712718aed5dd 100644
> --- a/arch/arm64/kernel/efi.c
> +++ b/arch/arm64/kernel/efi.c
> @@ -9,6 +9,7 @@
>
> #include <linux/efi.h>
> #include <linux/init.h>
> +#include <linux/kmemleak.h>
> #include <linux/screen_info.h>
> #include <linux/vmalloc.h>
>
> @@ -213,6 +214,7 @@ l: if (!p) {
> return -ENOMEM;
> }
>
> + kmemleak_not_leak(p);
> efi_rt_stack_top = p + THREAD_SIZE;

It looks like a false positive and the reason is that we only store
p + THREAD_SIZE in efi_rt_stack_top, not the actual allocated pointer.

--
Catalin