summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/smp_32.c
diff options
context:
space:
mode:
authorMike Travis2008-01-30 13:30:55 +0100
committerIngo Molnar2008-01-30 13:30:55 +0100
commit7bf0c23ed24b0d95a2a717f86dce1f210e16f8a5 (patch)
tree64f1d21cfcc7746d430c4ad70c864e176536ac8d /arch/x86/kernel/smp_32.c
parentx86: PTRACE_SINGLEBLOCK (diff)
downloadkernel-qcow2-linux-7bf0c23ed24b0d95a2a717f86dce1f210e16f8a5.tar.gz
kernel-qcow2-linux-7bf0c23ed24b0d95a2a717f86dce1f210e16f8a5.tar.xz
kernel-qcow2-linux-7bf0c23ed24b0d95a2a717f86dce1f210e16f8a5.zip
x86: prevent dereferencing non-allocated per_cpu variables
'for_each_possible_cpu(i)' when there's a _remote possibility_ of dereferencing a non-allocated per_cpu variable involved. All files except mm/vmstat.c are x86 arch. Thanks to pageexec@freemail.hu for pointing this out. Signed-off-by: Mike Travis <travis@sgi.com> Cc: Christoph Lameter <clameter@sgi.com> Cc: <pageexec@freemail.hu> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/smp_32.c')
-rw-r--r--arch/x86/kernel/smp_32.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kernel/smp_32.c b/arch/x86/kernel/smp_32.c
index fcaa026eb807..d4c01a4aca60 100644
--- a/arch/x86/kernel/smp_32.c
+++ b/arch/x86/kernel/smp_32.c
@@ -223,7 +223,7 @@ void send_IPI_mask_sequence(cpumask_t mask, int vector)
*/
local_irq_save(flags);
- for (query_cpu = 0; query_cpu < NR_CPUS; ++query_cpu) {
+ for_each_possible_cpu(query_cpu) {
if (cpu_isset(query_cpu, mask)) {
__send_IPI_dest_field(cpu_to_logical_apicid(query_cpu),
vector);
@@ -675,7 +675,7 @@ static int convert_apicid_to_cpu(int apic_id)
{
int i;
- for (i = 0; i < NR_CPUS; i++) {
+ for_each_possible_cpu(i) {
if (per_cpu(x86_cpu_to_apicid, i) == apic_id)
return i;
}