Commit b1b012e0 authored by Liu Shixin's avatar Liu Shixin
Browse files

bootmem: use kmemleak_free_part_phys in free_bootmem_page

mainline inclusion
from mainline-v6.7-rc1
commit 80203f1ca086835100843f1474bd6dd4a48cc73b
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAR7B3

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

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

Since kmemleak_alloc_phys() rather than kmemleak_alloc() was called from
memblock_alloc_range_nid(), kmemleak_free_part_phys() should be used to
delete kmemleak object in free_bootmem_page().  In debug mode, there are
following warning:

 kmemleak: Partially freeing unknown object at 0xffff97345aff7000 (size 4096)

Link: https://lkml.kernel.org/r/20231018102952.3339837-3-liushixin2@huawei.com


Fixes: 028725e7 ("bootmem: remove the vmemmap pages from kmemleak in free_bootmem_page")
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Patrick Wang <patrick.wang.shcn@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
parent add70aae
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ static inline void get_page_bootmem(unsigned long info, struct page *page,

static inline void free_bootmem_page(struct page *page)
{
	kmemleak_free_part(page_to_virt(page), PAGE_SIZE);
	kmemleak_free_part_phys(PFN_PHYS(page_to_pfn(page)), PAGE_SIZE);
	free_reserved_page(page);
}
#endif