aboutsummaryrefslogtreecommitdiffstats
path: root/mm/kmemleak.c
diff options
context:
space:
mode:
authorWang Kai <morgan.wang@huawei.com>2015-09-08 18:03:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 18:35:28 -0400
commit21cd3a604797c2774676926a95a3d17d4cd5cbb3 (patch)
tree83e3cd390ae01824f4d7aff599cfd292927e2549 /mm/kmemleak.c
parente3975891254e08d220ddcafca93a0e05d9560bfb (diff)
kmemleak: record accurate early log buffer count and report when exceeded
In log_early function, crt_early_log should also count once when 'crt_early_log >= ARRAY_SIZE(early_log)'. Otherwise the reported count from kmemleak_init is one less than 'actual number'. Then, in kmemleak_init, if early_log buffer size equal actual number, kmemleak will init sucessful, so change warning condition to 'crt_early_log > ARRAY_SIZE(early_log)'. Signed-off-by: Wang Kai <morgan.wang@huawei.com> Acked-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/kmemleak.c')
-rw-r--r--mm/kmemleak.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index cf79f110157c..f532f6a37b55 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -838,6 +838,7 @@ static void __init log_early(int op_type, const void *ptr, size_t size,
838 } 838 }
839 839
840 if (crt_early_log >= ARRAY_SIZE(early_log)) { 840 if (crt_early_log >= ARRAY_SIZE(early_log)) {
841 crt_early_log++;
841 kmemleak_disable(); 842 kmemleak_disable();
842 return; 843 return;
843 } 844 }
@@ -1882,7 +1883,7 @@ void __init kmemleak_init(void)
1882 object_cache = KMEM_CACHE(kmemleak_object, SLAB_NOLEAKTRACE); 1883 object_cache = KMEM_CACHE(kmemleak_object, SLAB_NOLEAKTRACE);
1883 scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE); 1884 scan_area_cache = KMEM_CACHE(kmemleak_scan_area, SLAB_NOLEAKTRACE);
1884 1885
1885 if (crt_early_log >= ARRAY_SIZE(early_log)) 1886 if (crt_early_log > ARRAY_SIZE(early_log))
1886 pr_warning("Early log buffer exceeded (%d), please increase " 1887 pr_warning("Early log buffer exceeded (%d), please increase "
1887 "DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n", crt_early_log); 1888 "DEBUG_KMEMLEAK_EARLY_LOG_SIZE\n", crt_early_log);
1888 1889