Skip to content

Commit 29091a5

Browse files
zijun-hurobherring
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent 267b21d commit 29091a5

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)