From: Lee Schermerhorn <lee.schermerhorn@hp.com>
To: Cliff Wickman <cpi@sgi.com>
Cc: Kornilios Kourtis <kkourt@cslab.ece.ntua.gr>,
Brice Goglin <Brice.Goglin@inria.fr>,
linux-numa@vger.kernel.org, eric.whitney@hp.com
Subject: [PATCH 2/8] numactl/libnuma - Simple bitmask leak fixes
Date: Tue, 28 Apr 2009 12:36:32 -0400 [thread overview]
Message-ID: <20090428163632.24945.26753.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090428163621.24945.95516.sendpatchset@localhost.localdomain>
[PATCH 02/08] Fix Simple Bitmask Leaks
Against: numactl-2.0.3-rc2
Add or move numa_bitmask_free() or exit via path that already
frees bitmask to plug leaks.
Kornilios pulled a couple of these hunks out of a single big patch
that I had originally created. I figured the node_parse_*string()
hunks were simple enough to fit here as well.
Note: this patch leaves a bitmask leak in numa_parse_nodestring()
that will be fixed in a later patch.
libnuma.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
Index: numactl-2.0.3-rc2/libnuma.c
===================================================================
--- numactl-2.0.3-rc2.orig/libnuma.c 2009-04-27 09:33:09.000000000 -0400
+++ numactl-2.0.3-rc2/libnuma.c 2009-04-27 09:34:40.000000000 -0400
@@ -755,6 +755,7 @@ void numa_tonode_memory(void *mem, size_
nodes = numa_allocate_nodemask();
numa_bitmask_setbit(nodes, node);
dombind(mem, size, bind_policy, nodes);
+ numa_bitmask_free(nodes);
}
void
@@ -882,6 +883,7 @@ numa_get_interleave_mask_v1(void)
copy_bitmask_to_nodemask(bmp, &mask);
else
copy_bitmask_to_nodemask(numa_no_nodes_ptr, &mask);
+ numa_bitmask_free(bmp);
return mask;
}
__asm__(".symver numa_get_interleave_mask_v1,numa_get_interleave_mask@libnuma_1.1");
@@ -1388,13 +1390,13 @@ numa_run_on_node_mask_v2(struct bitmask
}
err = numa_sched_setaffinity_v2_int(0, cpus);
+ numa_bitmask_free(cpus);
+ numa_bitmask_free(nodecpus);
+
/* used to have to consider that this could fail - it shouldn't now */
if (err < 0) {
numa_error("numa_sched_setaffinity_v2_int() failed; abort\n");
- return -1;
}
- numa_bitmask_free(cpus);
- numa_bitmask_free(nodecpus);
return err;
}
@@ -1662,7 +1664,7 @@ numa_parse_nodestring(char *s)
}
} while (*s++ == ',');
if (s[-1] != '\0')
- return 0;
+ goto err;
if (invert) {
int i;
for (i = 0; i < conf_nodes; i++) {
@@ -1758,7 +1760,7 @@ numa_parse_cpustring(char *s)
}
} while (*s++ == ',');
if (s[-1] != '\0')
- return 0;
+ goto err;
if (invert) {
int i;
for (i = 0; i < conf_cpus; i++) {
next prev parent reply other threads:[~2009-04-28 16:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-28 16:36 [PATCH 0/8] numactl/libnuma - Fixes and Cleanup Lee Schermerhorn
2009-04-28 16:36 ` [PATCH 1/8] numactl/libnuma - Possibly already fixed leaks and cleanup Lee Schermerhorn
2009-04-28 16:36 ` Lee Schermerhorn [this message]
2009-04-28 16:36 ` [PATCH 3/8] numactl/libnuma - more bitmask leak fixes Lee Schermerhorn
2009-04-28 16:36 ` [PATCH 4/8] numactl/libnuma - return freeable bitmasks Lee Schermerhorn
2009-04-28 16:36 ` [PATCH 5/8] numactl/libnuma - fix parsing of cpu, node mask Lee Schermerhorn
2009-04-28 16:36 ` [PATCH 6/8] numactl/numademo - eliminate page allocation overhead from memtest measurements Lee Schermerhorn
2009-04-28 16:37 ` [PATCH 7/8] numactl/Makefile - Generalize Makefile .so Version Lee Schermerhorn
2009-04-28 16:46 ` Andi Kleen
2009-04-28 17:01 ` Lee Schermerhorn
2009-04-28 17:10 ` Andi Kleen
2009-04-28 16:37 ` [PATCH 8/8] numactl/test - Make checkaffinity more robust Lee Schermerhorn
2009-04-28 19:38 ` [PATCH 0/8] numactl/libnuma - Fixes and Cleanup Cliff Wickman
2009-04-28 20:08 ` Lee Schermerhorn
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=20090428163632.24945.26753.sendpatchset@localhost.localdomain \
--to=lee.schermerhorn@hp.com \
--cc=Brice.Goglin@inria.fr \
--cc=cpi@sgi.com \
--cc=eric.whitney@hp.com \
--cc=kkourt@cslab.ece.ntua.gr \
--cc=linux-numa@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.