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

January 11th, 2012 - 03:20 am ET by Tiejun Chen | Report spam
We should only scan that invalid section which size is not
zero as well.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>

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

mm/kmemleak.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 2c0d032..98d62e3 100644
a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -923,7 +923,7 @@ void __ref kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp)
{
pr_debug("%s(0x%p)", __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);
1.6.0.4

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
email Follow the discussionReplies 1 replyReplies Make a reply

Replies

#1 Catalin Marinas
January 11th, 2012 - 04:30 am ET | Report spam
On Wed, Jan 11, 2012 at 05:51:10AM +0000, Tiejun Chen wrote:
We should only scan that invalid section which size is not
zero as well.

Signed-off-by: Tiejun Chen



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

Thanks.

Catalin
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Similar topics