From: ZhangPeng <zhangpeng362@huawei.com> hulk inclusion category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/13312 -------------------------------- When crash_base is set via kernel command line, reserve_crashkernel_high() does not allocate new memory and thus no kmemleak object is created. However, kmemleak_ignore_phys() was called unconditionally, leading to unnecessary kmemleak warnings. Move kmemleak_ignore_phys() inside the allocation branch where it's actually needed, ensuring it's only called when new memory is allocated and tracked by kmemleak. Fixes: 951001072323 ("arm64: kdump: Skip kmemleak scan reserved memory for kdump") Signed-off-by: ZhangPeng <zhangpeng362@huawei.com> Signed-off-by: Qi Xi <xiqi2@huawei.com> --- kernel/crash_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index a0ea5fe6fa60..79c0692a8899 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -413,13 +413,13 @@ void __init reserve_crashkernel_high(void) return; crash_high_mem_reserved = true; - } - /* - * The crashkernel memory will be removed from the kernel linear - * map. Inform kmemleak so that it won't try to access it. - */ - kmemleak_ignore_phys(crash_base); + /* + * The crashkernel memory will be removed from the kernel linear + * map. Inform kmemleak so that it won't try to access it. + */ + kmemleak_ignore_phys(crash_base); + } /* Mark the memory range that requires page-level mappings */ crashk_res.start = crash_base; -- 2.33.0