aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memblock.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2014-06-06 17:38:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-06 19:08:17 -0400
commitaedf95ea0583676cd7bfa395681ad744791a433e (patch)
treeec6157cd2cd37203373c4e1c8ccf93906ceed7f0 /mm/memblock.c
parent174119628188b085c66fe7d86fbfb4cccb1bd864 (diff)
mm/memblock.c: call kmemleak directly from memblock_(alloc|free)
Kmemleak could ignore memory blocks allocated via memblock_alloc() leading to false positives during scanning. This patch adds the corresponding callbacks and removes kmemleak_free_* calls in mm/nobootmem.c to avoid duplication. The kmemleak_alloc() in mm/nobootmem.c is kept since __alloc_memory_core_early() does not use memblock_alloc() directly. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memblock.c')
-rw-r--r--mm/memblock.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 0aa0d2b07624..6d2f219a48b0 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -691,6 +691,7 @@ int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
691 (unsigned long long)base + size - 1, 691 (unsigned long long)base + size - 1,
692 (void *)_RET_IP_); 692 (void *)_RET_IP_);
693 693
694 kmemleak_free_part(__va(base), size);
694 return memblock_remove_range(&memblock.reserved, base, size); 695 return memblock_remove_range(&memblock.reserved, base, size);
695} 696}
696 697
@@ -1043,9 +1044,14 @@ static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size,
1043 align = SMP_CACHE_BYTES; 1044 align = SMP_CACHE_BYTES;
1044 1045
1045 found = memblock_find_in_range_node(size, align, start, end, nid); 1046 found = memblock_find_in_range_node(size, align, start, end, nid);
1046 if (found && !memblock_reserve(found, size)) 1047 if (found && !memblock_reserve(found, size)) {
1048 /*
1049 * The min_count is set to 0 so that memblock allocations are
1050 * never reported as leaks.
1051 */
1052 kmemleak_alloc(__va(found), size, 0, 0);
1047 return found; 1053 return found;
1048 1054 }
1049 return 0; 1055 return 0;
1050} 1056}
1051 1057