Commit 35bff081 authored by Martin J. Bligh's avatar Martin J. Bligh Committed by Linus Torvalds

[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.
parent cf4b1f75
......@@ -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");
......
......@@ -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,
......
......@@ -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,
......
......@@ -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",
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment