The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.17-rc5 6/7] Remove some of the kmemleak false positives
Date: Tue, 30 May 2006 15:07:32 +0100	[thread overview]
Message-ID: <20060530140732.21491.50139.stgit@localhost.localdomain> (raw)
In-Reply-To: <20060530135016.21491.34817.stgit@localhost.localdomain>

From: Catalin Marinas <catalin.marinas@arm.com>

There are allocations for which the main pointer cannot be found but they
are not memory leaks. This patch fixes some of them.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---

 arch/i386/kernel/setup.c |    1 +
 ipc/util.c               |    2 ++
 kernel/module.c          |    2 ++
 kernel/params.c          |    7 +++++--
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 846e163..a6407f6 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -1323,6 +1323,7 @@ legacy_init_iomem_resources(struct resou
 		if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL)
 			continue;
 		res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
+		memleak_debug_not_leak(res);
 		switch (e820.map[i].type) {
 		case E820_RAM:	res->name = "System RAM"; break;
 		case E820_ACPI:	res->name = "ACPI Tables"; break;
diff --git a/ipc/util.c b/ipc/util.c
index 8193299..40014a4 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -389,6 +389,7 @@ void* ipc_rcu_alloc(int size)
 	 */
 	if (rcu_use_vmalloc(size)) {
 		out = vmalloc(HDRLEN_VMALLOC + size);
+		memleak_debug_not_leak(out);
 		if (out) {
 			out += HDRLEN_VMALLOC;
 			container_of(out, struct ipc_rcu_hdr, data)->is_vmalloc = 1;
@@ -396,6 +397,7 @@ void* ipc_rcu_alloc(int size)
 		}
 	} else {
 		out = kmalloc(HDRLEN_KMALLOC + size, GFP_KERNEL);
+		memleak_debug_not_leak(out);
 		if (out) {
 			out += HDRLEN_KMALLOC;
 			container_of(out, struct ipc_rcu_hdr, data)->is_vmalloc = 0;
diff --git a/kernel/module.c b/kernel/module.c
index 9b400dc..1c9f04e 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1576,6 +1576,7 @@ #endif
 
 	/* Do the allocs. */
 	ptr = module_alloc(mod->core_size);
+	memleak_debug_not_leak(ptr);
 	if (!ptr) {
 		err = -ENOMEM;
 		goto free_percpu;
@@ -1584,6 +1585,7 @@ #endif
 	mod->module_core = ptr;
 
 	ptr = module_alloc(mod->init_size);
+	memleak_debug_ignore(ptr);
 	if (!ptr && mod->init_size) {
 		err = -ENOMEM;
 		goto free_core;
diff --git a/kernel/params.c b/kernel/params.c
index af43ecd..6c04a68 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -548,6 +548,7 @@ static void __init kernel_param_sysfs_se
 					    unsigned int name_skip)
 {
 	struct module_kobject *mk;
+	struct module_param_attrs *mp;
 
 	mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL);
 	BUG_ON(!mk);
@@ -557,11 +558,13 @@ static void __init kernel_param_sysfs_se
 	kobject_set_name(&mk->kobj, name);
 	kobject_register(&mk->kobj);
 
+	mp = param_sysfs_setup(mk, kparam, num_params, name_skip);
 	/* no need to keep the kobject if no parameter is exported */
-	if (!param_sysfs_setup(mk, kparam, num_params, name_skip)) {
+	if (!mp) {
 		kobject_unregister(&mk->kobj);
 		kfree(mk);
-	}
+	} else
+		memleak_debug_not_leak(mp);
 }
 
 /*

  parent reply	other threads:[~2006-05-30 14:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-30 13:50 [PATCH 2.6.17-rc5 0/7] Kernel memory leak detector 0.3 Catalin Marinas
2006-05-30 14:07 ` [PATCH 2.6.17-rc5 1/7] Base support for kmemleak Catalin Marinas
2006-05-30 14:07 ` [PATCH 2.6.17-rc5 2/7] Some documentation " Catalin Marinas
2006-05-30 14:07 ` [PATCH 2.6.17-rc5 3/7] Add the memory allocation/freeing hooks " Catalin Marinas
2006-05-30 14:07 ` [PATCH 2.6.17-rc5 4/7] Add kmemleak support for i386 Catalin Marinas
2006-05-30 14:07 ` [PATCH 2.6.17-rc5 5/7] Add kmemleak support for ARM Catalin Marinas
2006-05-30 14:07 ` Catalin Marinas [this message]
2006-05-30 14:07 ` [PATCH 2.6.17-rc5 7/7] Simple testing for kmemleak Catalin Marinas
2006-05-30 14:17 ` [PATCH 2.6.17-rc5 0/7] Kernel memory leak detector 0.3 Catalin Marinas
  -- strict thread matches above, loose matches on Subject: below --
2006-05-27 12:07 [PATCH 2.6.17-rc5 0/7] Kernel memory leak detector 0.2 Catalin Marinas
2006-05-27 12:23 ` [PATCH 2.6.17-rc5 6/7] Remove some of the kmemleak false positives Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060530140732.21491.50139.stgit@localhost.localdomain \
    --to=catalin.marinas@arm.com \
    --cc=catalin.marinas@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox