Commit 857033a6 authored by Alexey Starikovskiy's avatar Alexey Starikovskiy Committed by Ingo Molnar

x86: add bad_ioapic to mpparse_32.c

Signed-off-by: default avatarAlexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent d2953315
...@@ -287,6 +287,21 @@ static void __init MP_bus_info (struct mpc_config_bus *m) ...@@ -287,6 +287,21 @@ static void __init MP_bus_info (struct mpc_config_bus *m)
} }
} }
static int bad_ioapic(unsigned long address)
{
if (nr_ioapics >= MAX_IO_APICS) {
printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
"(found %d)\n", MAX_IO_APICS, nr_ioapics);
panic("Recompile kernel with bigger MAX_IO_APICS!\n");
}
if (!address) {
printk(KERN_ERR "WARNING: Bogus (zero) I/O APIC address"
" found in table, skipping!\n");
return 1;
}
return 0;
}
static void __init MP_ioapic_info (struct mpc_config_ioapic *m) static void __init MP_ioapic_info (struct mpc_config_ioapic *m)
{ {
if (!(m->mpc_flags & MPC_APIC_USABLE)) if (!(m->mpc_flags & MPC_APIC_USABLE))
...@@ -294,16 +309,10 @@ static void __init MP_ioapic_info (struct mpc_config_ioapic *m) ...@@ -294,16 +309,10 @@ static void __init MP_ioapic_info (struct mpc_config_ioapic *m)
printk(KERN_INFO "I/O APIC #%d Version %d at 0x%X.\n", printk(KERN_INFO "I/O APIC #%d Version %d at 0x%X.\n",
m->mpc_apicid, m->mpc_apicver, m->mpc_apicaddr); m->mpc_apicid, m->mpc_apicver, m->mpc_apicaddr);
if (nr_ioapics >= MAX_IO_APICS) {
printk(KERN_CRIT "Max # of I/O APICs (%d) exceeded (found %d).\n", if (bad_ioapic(m->mpc_apicaddr))
MAX_IO_APICS, nr_ioapics);
panic("Recompile kernel with bigger MAX_IO_APICS!.\n");
}
if (!m->mpc_apicaddr) {
printk(KERN_ERR "WARNING: bogus zero I/O APIC address"
" found in MP table, skipping!\n");
return; return;
}
mp_ioapics[nr_ioapics] = *m; mp_ioapics[nr_ioapics] = *m;
nr_ioapics++; nr_ioapics++;
} }
...@@ -918,16 +927,8 @@ void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base) ...@@ -918,16 +927,8 @@ void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base)
int idx = 0; int idx = 0;
int tmpid; int tmpid;
if (nr_ioapics >= MAX_IO_APICS) { if (bad_ioapic(address))
printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
"(found %d)\n", MAX_IO_APICS, nr_ioapics);
panic("Recompile kernel with bigger MAX_IO_APICS!\n");
}
if (!address) {
printk(KERN_ERR "WARNING: Bogus (zero) I/O APIC address"
" found in MADT table, skipping!\n");
return; return;
}
idx = nr_ioapics++; idx = nr_ioapics++;
......
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