kmemleak: Add callbacks to the bootmem allocator

This patch adds kmemleak_alloc/free callbacks to the bootmem allocator.
This would allow scanning of such blocks and help avoiding a whole class
of false positives and more kmemleak annotations.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>

+6
+6
mm/bootmem.c
··· 12 #include <linux/pfn.h> 13 #include <linux/bootmem.h> 14 #include <linux/module.h> 15 16 #include <asm/bug.h> 17 #include <asm/io.h> ··· 336 { 337 unsigned long start, end; 338 339 start = PFN_UP(physaddr); 340 end = PFN_DOWN(physaddr + size); 341 ··· 356 void __init free_bootmem(unsigned long addr, unsigned long size) 357 { 358 unsigned long start, end; 359 360 start = PFN_UP(addr); 361 end = PFN_DOWN(addr + size); ··· 521 region = phys_to_virt(PFN_PHYS(bdata->node_min_pfn) + 522 start_off); 523 memset(region, 0, size); 524 return region; 525 } 526
··· 12 #include <linux/pfn.h> 13 #include <linux/bootmem.h> 14 #include <linux/module.h> 15 + #include <linux/kmemleak.h> 16 17 #include <asm/bug.h> 18 #include <asm/io.h> ··· 335 { 336 unsigned long start, end; 337 338 + kmemleak_free_part(__va(physaddr), size); 339 + 340 start = PFN_UP(physaddr); 341 end = PFN_DOWN(physaddr + size); 342 ··· 353 void __init free_bootmem(unsigned long addr, unsigned long size) 354 { 355 unsigned long start, end; 356 + 357 + kmemleak_free_part(__va(addr), size); 358 359 start = PFN_UP(addr); 360 end = PFN_DOWN(addr + size); ··· 516 region = phys_to_virt(PFN_PHYS(bdata->node_min_pfn) + 517 start_off); 518 memset(region, 0, size); 519 + kmemleak_alloc(region, size, 1, 0); 520 return region; 521 } 522