public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Vegard Nossum <vegard.nossum@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: linux-next: Tree for June 5
Date: Fri, 06 Jun 2008 08:52:46 -0700	[thread overview]
Message-ID: <48495D4E.2070203@sgi.com> (raw)
In-Reply-To: <20080606152326.GA18359@elte.hu>

Ingo Molnar wrote:
> * Vegard Nossum <vegard.nossum@gmail.com> wrote:
> 
>>>> AFAICS this is not yet required for v2.6.26, as the requirement to 
>>>> never iterate to MAX_NUMNODES and call nr_cpus_node() with the 
>>>> index only got introduced by Mike's patch.
>>> the one below is needed as well i think.
>> Yeah. I think you had better take Mike's patches, I don't trust even 
>> that my patch and your fixlet does everything correctly.
> 
> yep, just discovered that we had them already ;-)
> 
> Thomas has just scripted up a new "detect if a commit is not in 
> linux-next yet" script that should avoid such problems in the future.
> 
> your second patch is still wanted, it would have detected the problem 
> earlier.
> 
> 	Ingo

Thanks, yes, I agree.  However I would like to modify it slightly:
---
Subject: [PATCH 1/1] x86: Add check for node passed to node_to_cpumask

  * When CONFIG_DEBUG_PER_CPU_MAPS is set, the node passed to
    node_to_cpumask and node_to_cpumask_ptr should be validated.

Signed-off-by: Mike Travis <travis@sgi.com>
---
 arch/x86/kernel/setup.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

--- linux-2.6.tip.orig/arch/x86/kernel/setup.c
+++ linux-2.6.tip/arch/x86/kernel/setup.c
@@ -399,6 +399,10 @@ int early_cpu_to_node(int cpu)
 	return per_cpu(x86_cpu_to_node_map, cpu);
 }
 
+
+/* empty cpumask */
+static cpumask_t cpu_mask_none;
+
 /*
  * Returns a pointer to the bitmask of CPUs on Node 'node'.
  */
@@ -411,6 +415,13 @@ cpumask_t *_node_to_cpumask_ptr(int node
 		dump_stack();
 		return &cpu_online_map;
 	}
+	if (node >= nr_node_ids) {
+		printk(KERN_WARNING
+			"_node_to_cpumask_ptr(%d): node > nr_node_ids(%d)\n",
+			node, nr_node_ids);
+		dump_stack();
+		return &cpu_mask_none;
+	}
 	return &node_to_cpumask_map[node];
 }
 EXPORT_SYMBOL(_node_to_cpumask_ptr);
@@ -426,6 +437,13 @@ cpumask_t node_to_cpumask(int node)
 		dump_stack();
 		return cpu_online_map;
 	}
+	if (node >= nr_node_ids) {
+		printk(KERN_WARNING
+			"node_to_cpumask(%d): node > nr_node_ids(%d)\n",
+			node, nr_node_ids);
+		dump_stack();
+		return cpu_mask_none;
+	}
 	return node_to_cpumask_map[node];
 }
 EXPORT_SYMBOL(node_to_cpumask);

  reply	other threads:[~2008-06-06 15:53 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-05  7:52 linux-next: Tree for June 5 Stephen Rothwell
2008-06-06  2:56 ` Andrew Morton
2008-06-06  3:46   ` Andrew Morton
2008-06-06  7:17   ` Ingo Molnar
2008-06-06  7:25     ` Ingo Molnar
2008-06-06  7:33       ` Andrew Morton
2008-06-06  7:41         ` Ingo Molnar
2008-06-06  7:47           ` Andrew Morton
2008-06-06  7:53             ` Stephen Rothwell
2008-06-06  8:01               ` Andrew Morton
2008-06-06  8:22                 ` Stephen Rothwell
2008-06-06  8:30                   ` Andrew Morton
2008-06-06  8:36                     ` Ingo Molnar
2008-06-06 11:50                     ` Paul Mackerras
2008-06-06  8:27               ` Ingo Molnar
2008-06-06  8:23             ` Ingo Molnar
2008-06-06  8:28               ` Stephen Rothwell
2008-06-06  8:33                 ` Ingo Molnar
2008-06-06  8:38               ` Andrew Morton
2008-06-06  8:49                 ` Ingo Molnar
2008-06-06  9:01                   ` Andrew Morton
2008-06-06 10:47                     ` Ingo Molnar
2008-06-06 16:37                       ` Ingo Molnar
2008-06-06  7:29     ` Andrew Morton
2008-06-06  9:48       ` Andrew Morton
2008-06-06  9:54         ` Andrew Morton
2008-06-06 10:10           ` Ingo Molnar
2008-06-06 10:54         ` Andrew Morton
2008-06-06 11:21           ` Vegard Nossum
2008-06-06 11:57           ` Ingo Molnar
2008-06-06 12:33             ` Vegard Nossum
2008-06-06 13:33               ` Mike Travis
2008-06-06 13:50                 ` Vegard Nossum
2008-06-06 14:07                   ` Vegard Nossum
2008-06-06 14:20                     ` Mike Travis
2008-06-06 14:36                       ` Vegard Nossum
2008-06-06 14:41                         ` Mike Travis
2008-06-06 14:51                           ` Mike Travis
2008-06-06 14:54                             ` Mike Travis
2008-06-06 14:57                         ` Ingo Molnar
2008-06-06 15:01                           ` Ingo Molnar
2008-06-06 15:13                             ` Vegard Nossum
2008-06-06 15:23                               ` Ingo Molnar
2008-06-06 15:52                                 ` Mike Travis [this message]
2008-06-18  8:26                                   ` Ingo Molnar
2008-06-06 15:04                           ` Mike Travis
2008-06-06 15:20                             ` Mike Travis
2008-06-06 15:33                               ` Ingo Molnar
2008-06-06 15:13                           ` Ingo Molnar
2008-06-06 14:13                   ` Mike Travis
2008-06-06 13:28           ` Mike Travis
2008-06-06 17:15           ` Ingo Molnar
2008-06-06  7:33     ` Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2009-06-05  6:41 Stephen Rothwell

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=48495D4E.2070203@sgi.com \
    --to=travis@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sfr@canb.auug.org.au \
    --cc=tglx@linutronix.de \
    --cc=vegard.nossum@gmail.com \
    /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