Skip to content

Commit 3dcaa6d

Browse files
author
Maxime Ripard
committed
of: reserved-memory: Do not make kmemleak ignore freed address
JIRA: https://issues.redhat.com/browse/RHEL-125402 commit 29091a5 Author: Zijun Hu <quic_zijuhu@quicinc.com> Date: 2025-01-09 21:27:01 +0800 of: reserved-memory: Do not make kmemleak ignore freed address early_init_dt_alloc_reserved_memory_arch() will free address @base when suffers memblock_mark_nomap() error, but it still makes kmemleak ignore the freed address @base via kmemleak_ignore_phys(). That is unnecessary, besides, also causes unnecessary warning messages: kmemleak_ignore_phys() -> make_black_object() -> paint_ptr() -> kmemleak_warn() // warning message here. Fix by avoiding kmemleak_ignore_phys() when suffer the error. Fixes: 658aafc ("memblock: exclude MEMBLOCK_NOMAP regions from kmemleak") Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Link: https://lore.kernel.org/r/20250109-of_core_fix-v4-10-db8a72415b8c@quicinc.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Maxime Ripard <mripard@redhat.com>
1 parent 8b20c63 commit 3dcaa6d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/of/of_reserved_mem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
5252
memblock_phys_free(base, size);
5353
}
5454

55-
kmemleak_ignore_phys(base);
55+
if (!err)
56+
kmemleak_ignore_phys(base);
5657

5758
return err;
5859
}

0 commit comments

Comments
 (0)