From 35bff081e0b82f9bfcdfaf026ec5bf4c82c950b1 Mon Sep 17 00:00:00 2001 From: "Martin J. Bligh" Date: Thu, 27 Feb 2003 23:02:21 -0800 Subject: [PATCH] [PATCH] Fix potential NULL pointer translation_table could be unintialised on machines other than NUMA-Q. You never see this, as the compiler happens to optimise it away, but it's still a Really Bad Idea (tm). Thanks to someone whose name I have unfortunately forgotten for pointing this out. Has been tested in my tree for over two weeks on UP, SMP, and NUMA and compile tested against a variety of different configs. --- arch/i386/kernel/mpparse.c | 2 +- include/asm-i386/mach-bigsmp/mach_apic.h | 3 ++- include/asm-i386/mach-default/mach_apic.h | 3 ++- include/asm-i386/mach-numaq/mach_apic.h | 4 +++- include/asm-i386/mach-summit/mach_apic.h | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index c7164ac8d3749..33a11551c5815 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c @@ -110,7 +110,7 @@ void __init MP_processor_info (struct mpc_config_processor *m) if (!(m->mpc_cpuflag & CPU_ENABLED)) return; - apicid = mpc_apic_id(m, translation_table[mpc_record]->trans_quad); + apicid = mpc_apic_id(m, translation_table[mpc_record]); if (m->mpc_featureflag&(1<<0)) Dprintk(" Floating point unit present.\n"); diff --git a/include/asm-i386/mach-bigsmp/mach_apic.h b/include/asm-i386/mach-bigsmp/mach_apic.h index 1572455d35f7f..d5f799de14ef4 100644 --- a/include/asm-i386/mach-bigsmp/mach_apic.h +++ b/include/asm-i386/mach-bigsmp/mach_apic.h @@ -87,7 +87,8 @@ static inline int cpu_to_logical_apicid(int cpu) return (int)cpu_2_logical_apicid[cpu]; } -static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) +static inline int mpc_apic_id(struct mpc_config_processor *m, + struct mpc_config_translation *translation_record) { printk("Processor #%d %ld:%ld APIC version %d\n", m->mpc_apicid, diff --git a/include/asm-i386/mach-default/mach_apic.h b/include/asm-i386/mach-default/mach_apic.h index 0f2c11b413d52..eb0b126c5b3c5 100644 --- a/include/asm-i386/mach-default/mach_apic.h +++ b/include/asm-i386/mach-default/mach_apic.h @@ -79,7 +79,8 @@ static inline unsigned long apicid_to_cpu_present(int phys_apicid) return (1ul << phys_apicid); } -static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) +static inline int mpc_apic_id(struct mpc_config_processor *m, + struct mpc_config_translation *translation_record) { printk("Processor #%d %ld:%ld APIC version %d\n", m->mpc_apicid, diff --git a/include/asm-i386/mach-numaq/mach_apic.h b/include/asm-i386/mach-numaq/mach_apic.h index 84b36fe4ee7c1..bb63a26b3eb22 100644 --- a/include/asm-i386/mach-numaq/mach_apic.h +++ b/include/asm-i386/mach-numaq/mach_apic.h @@ -73,8 +73,10 @@ static inline unsigned long apicid_to_cpu_present(int logical_apicid) return ( (logical_apicid&0xf) << (4*apicid_to_node(logical_apicid)) ); } -static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) +static inline int mpc_apic_id(struct mpc_config_processor *m, + struct mpc_config_translation *translation_record) { + int quad = translation_record->trans_quad; int logical_apicid = generate_logical_apicid(quad, m->mpc_apicid); printk("Processor #%d %ld:%ld APIC version %d (quad %d, apic %d)\n", diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h index ac24bc91723de..6ac0d6b9e861b 100644 --- a/include/asm-i386/mach-summit/mach_apic.h +++ b/include/asm-i386/mach-summit/mach_apic.h @@ -90,7 +90,8 @@ static inline unsigned long apicid_to_cpu_present(int apicid) return (1ul << apicid); } -static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) +static inline int mpc_apic_id(struct mpc_config_processor *m, + struct mpc_config_translation *translation_record) { printk("Processor #%d %ld:%ld APIC version %d\n", m->mpc_apicid, -- 2.53.0