Skip to content

Commit

Permalink
kmemleak: Only scan non-zero-size areas
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Catalin Marinas <[email protected]>
  • Loading branch information
Tiejun Chen authored and ctmarinas committed Jan 20, 2012
1 parent dcd6c92 commit b469d43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/kmemleak.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b469d43

Please sign in to comment.