Commit 0c1d0a68 authored by Waiman Long's avatar Waiman Long Committed by Lin Yujun
Browse files

efi/arm64: Fix kmemleak false positive in arm64_efi_rt_init()

mainline inclusion
from mainline-v6.10-rc5
commit 46e27b9961d8712bc89234444ede314cec0e8bae
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBYAYI

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=46e27b9961d8712bc89234444ede314cec0e8bae



--------------------------------

The kmemleak code sometimes complains about the following leak:

unreferenced object 0xffff8000102e0000 (size 32768):
  comm "swapper/0", pid 1, jiffies 4294937323 (age 71.240s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000db9a88a3>] __vmalloc_node_range+0x324/0x450
    [<00000000ff8903a4>] __vmalloc_node+0x90/0xd0
    [<000000001a06634f>] arm64_efi_rt_init+0x64/0xdc
    [<0000000007826a8d>] do_one_initcall+0x178/0xac0
    [<0000000054a87017>] do_initcalls+0x190/0x1d0
    [<00000000308092d0>] kernel_init_freeable+0x2c0/0x2f0
    [<000000003e7b99e0>] kernel_init+0x28/0x14c
    [<000000002246af5b>] ret_from_fork+0x10/0x20

The memory object in this case is for efi_rt_stack_top and is allocated
in an initcall. So this is certainly a false positive. Mark the object
as not a leak to quash it.

Signed-off-by: default avatarWaiman Long <longman@redhat.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Conflicts:
	arch/arm64/kernel/efi.c
[fix context conflicts]
Signed-off-by: default avatarLin Yujun <linyujun809@huawei.com>
parent 75db7d4f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@

#include <linux/efi.h>
#include <linux/init.h>
#include <linux/kmemleak.h>
#include <linux/screen_info.h>

#include <asm/efi.h>
@@ -217,6 +218,7 @@ l: if (!p) {
		return -ENOMEM;
	}

	kmemleak_not_leak(p);
	efi_rt_stack_top = p + THREAD_SIZE;
	return 0;
}