Commit ec3a354bd46cbdaa7933ba57a142ee2d2dbde0e5

Authored by Catalin Marinas
1 parent 53238a60dd

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>

Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff

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