]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/memblock.c
mm/memblock.c: call kmemleak directly from memblock_(alloc|free)
[karo-tx-linux.git] / mm / memblock.c
index 0aa0d2b0762443d90a9f432a7969bef24b02c09b..6d2f219a48b01d371c1eb763f611d29a346890d9 100644 (file)
@@ -691,6 +691,7 @@ int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
                     (unsigned long long)base + size - 1,
                     (void *)_RET_IP_);
 
+       kmemleak_free_part(__va(base), size);
        return memblock_remove_range(&memblock.reserved, base, size);
 }
 
@@ -1043,9 +1044,14 @@ static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size,
                align = SMP_CACHE_BYTES;
 
        found = memblock_find_in_range_node(size, align, start, end, nid);
-       if (found && !memblock_reserve(found, size))
+       if (found && !memblock_reserve(found, size)) {
+               /*
+                * The min_count is set to 0 so that memblock allocations are
+                * never reported as leaks.
+                */
+               kmemleak_alloc(__va(found), size, 0, 0);
                return found;
-
+       }
        return 0;
 }