linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix a SEGV due to uninitialised mask
@ 2015-02-17  4:06 Daniel J Blueman
  2015-02-18 21:39 ` Filipe Brandenburger
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel J Blueman @ 2015-02-17  4:06 UTC (permalink / raw)
  To: linux-numa; +Cc: Daniel J Blueman, Steffen Persvold

As node_cpu_mask_v2 is not defined as local to the compilation unit with
'static', it is not guaranteed to be initialised to zero (ie in the .bss).
This was leading to some SEGVs we've seen.

Also mark another internal function local to the compilation unit.

Signed-off-by: Daniel J Blueman <daniel@numascale.com>
---
 libnuma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libnuma.c b/libnuma.c
index 8d7bf13..3717d5b 100644
--- a/libnuma.c
+++ b/libnuma.c
@@ -58,7 +58,7 @@ struct bitmask *numa_possible_cpus_ptr = NULL;
 struct bitmask *numa_nodes_ptr = NULL;
 static struct bitmask *numa_memnode_ptr = NULL;
 static unsigned long *node_cpu_mask_v1[NUMA_NUM_NODES];
-struct bitmask **node_cpu_mask_v2;
+static struct bitmask **node_cpu_mask_v2;
 
 WEAK void numa_error(char *where);
 
@@ -1234,7 +1234,7 @@ numa_parse_bitmap_v2(char *line, struct bitmask *mask)
 __asm__(".symver numa_parse_bitmap_v2,numa_parse_bitmap@@libnuma_1.2");
 
 void
-init_node_cpu_mask_v2(void)
+static init_node_cpu_mask_v2(void)
 {
 	int nnodes = numa_max_possible_node_v2_int() + 1;
 	node_cpu_mask_v2 = calloc (nnodes, sizeof(struct bitmask *));
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix a SEGV due to uninitialised mask
  2015-02-17  4:06 [PATCH] Fix a SEGV due to uninitialised mask Daniel J Blueman
@ 2015-02-18 21:39 ` Filipe Brandenburger
  0 siblings, 0 replies; 2+ messages in thread
From: Filipe Brandenburger @ 2015-02-18 21:39 UTC (permalink / raw)
  To: Daniel J Blueman; +Cc: linux-numa, Steffen Persvold, Cliff Wickman

Hi,

On Mon, Feb 16, 2015 at 8:06 PM, Daniel J Blueman <daniel@numascale.com> wrote:
> As node_cpu_mask_v2 is not defined as local to the compilation unit with
> 'static', it is not guaranteed to be initialised to zero (ie in the .bss).
> This was leading to some SEGVs we've seen.
>
> Also mark another internal function local to the compilation unit.
>
> Signed-off-by: Daniel J Blueman <daniel@numascale.com>

Pushed. Thanks for the contribution!

Cheers,
Filipe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-18 21:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-17  4:06 [PATCH] Fix a SEGV due to uninitialised mask Daniel J Blueman
2015-02-18 21:39 ` Filipe Brandenburger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).