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 <tiejun.chen@windriver.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
This commit is contained in:
Tiejun Chen 2012-01-11 05:51:10 +00:00 committed by Catalin Marinas
parent dcd6c92267
commit b469d4329c

View file

@ -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); 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); add_scan_area((unsigned long)ptr, size, gfp);
else if (atomic_read(&kmemleak_early_log)) else if (atomic_read(&kmemleak_early_log))
log_early(KMEMLEAK_SCAN_AREA, ptr, size, 0); log_early(KMEMLEAK_SCAN_AREA, ptr, size, 0);