Browse files

kmemleak: Only scan non-zero-size areas

Kmemleak should only track valid scan areas with a non-zero size.
Otherwise, such area may reside just at the end of an object and
kmemleak would report "Adding scan area to unknown object".

Signed-off-by: Tiejun Chen <>
Signed-off-by: Catalin Marinas <>
  • Loading branch information...
1 parent dcd6c92 commit b469d4329cf949043f9b93a6644f2c64015ef8cd Tiejun Chen committed with ctmarinas Jan 11, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 mm/kmemleak.c
@@ -1036,7 +1036,7 @@ void __ref kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp)
pr_debug("%s(0x%p)\n", __func__, ptr);
- if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr))
+ if (atomic_read(&kmemleak_enabled) && ptr && size && !IS_ERR(ptr))
add_scan_area((unsigned long)ptr, size, gfp);
else if (atomic_read(&kmemleak_early_log))
log_early(KMEMLEAK_SCAN_AREA, ptr, size, 0);

0 comments on commit b469d43

Please sign in to comment.