mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
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:
parent
dcd6c92267
commit
b469d4329c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user