public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Keith Mannthey <kmannth@gmail.com>, Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: [PATCH] x86_64 NUMA : Bug correction in populate_memnodemap()
Date: Wed, 07 Dec 2005 16:35:18 +0100	[thread overview]
Message-ID: <43970136.4010006@cosmosbay.com> (raw)
In-Reply-To: <a762e240512062124i517a9c35xd1ec681428418341@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

As reported by Keith Mannthey, there are problems in populate_memnodemap()

The bug was that the compute_hash_shift() was returning 31, with incorrect 
initialization of memnodemap[]

To correct the bug, we must use (1UL << shift) instead of (1 << shift) to 
avoid an integer overflow, and we must check that shift < 64 to avoid an 
infinite loop.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>


[-- Attachment #2: populate_memnodemap.patch --]
[-- Type: text/plain, Size: 594 bytes --]

--- linux-2.6.15-rc5/arch/x86_64/mm/numa.c	2005-12-04 06:10:42.000000000 +0100
+++ linux-2.6.15-rc5-ed/arch/x86_64/mm/numa.c	2005-12-07 16:45:15.000000000 +0100
@@ -53,6 +53,8 @@
 	int res = -1;
 	unsigned long addr, end;
 
+	if (shift >= 64)
+		return -1;
 	memset(memnodemap, 0xff, sizeof(memnodemap));
 	for (i = 0; i < numnodes; i++) {
 		addr = nodes[i].start;
@@ -65,7 +67,7 @@
 			if (memnodemap[addr >> shift] != 0xff)
 				return -1;
 			memnodemap[addr >> shift] = i;
-			addr += (1 << shift);
+                       addr += (1UL << shift);
 		} while (addr < end);
 		res = 1;
 	} 

       reply	other threads:[~2005-12-07 15:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a762e240512062124i517a9c35xd1ec681428418341@mail.gmail.com>
2005-12-07 15:35 ` Eric Dumazet [this message]
2005-12-07 17:46   ` [PATCH] x86_64 NUMA : Bug correction in populate_memnodemap() Andi Kleen
2005-12-11 18:27   ` Andi Kleen
2005-12-12  8:34     ` Eric Dumazet

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=43970136.4010006@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=ak@suse.de \
    --cc=kmannth@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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