Skip to contentSkip to conversation

kmemleak: only scan non-zero-size section

PATCH In review Tiejun Chen 2 participants 2 messages Jan 11, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kmemleak: only scan non-zero-size section

We should only scan that invalid section which size is not zero as well.

---
change for v2
* go a common point, kmemleak_scan_area(), to check size

 mm/kmemleak.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/kmemleak.c +1 -1
index 2c0d032..98d62e3 100644
@@ -923,7 +923,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);
Signature · 1 line
1.6.0.4
maintainer
#1 lore raw
Quoted 4 lines · Tiejun Chen

We should only scan that invalid section which size is not zero as well.

Looks good. I'll merge it in my kmemleak branch (and send it to Linus at some point).

Thanks.

Signature · 1 line
Catalin