Messages in this thread Patch in this message | | | Date | Tue, 20 Apr 2004 16:23:12 -0700 | From | William Lee Irwin III <> | Subject | Re: linux-2.4.26 released |
| |
On Wed, Apr 14, 2004 at 06:14:37AM -0700, Marcelo Tosatti wrote: > final: > - 2.4.26-rc4 was released as 2.4.26 with no changes.
Spotted by Joel Becker. Lookup through raw_phys_apicid[] needs bounds checks, otherwise the APIC ID returned may be fetched from memory beyond the end of the array resulting in various boot-time catastrophes. I took the liberty of slightly rearranging cpu_present_to_apicid() in the interest of clarity and/or Documentation/CodingStyle in the process.
-- wli
diff -puN include/asm-i386/smpboot.h~smp_boot_cpus include/asm-i386/smpboot.h --- linux-2.4.21/include/asm-i386/smpboot.h~smp_boot_cpus 2004-04-20 15:52:15.000000000 -0700 +++ linux-2.4.21-wli/include/asm-i386/smpboot.h 2004-04-20 16:00:02.000000000 -0700 @@ -73,11 +73,18 @@ extern unsigned char raw_phys_apicid[NR_ */ static inline int cpu_present_to_apicid(int mps_cpu) { - if (clustered_apic_mode == CLUSTERED_APIC_XAPIC) - return raw_phys_apicid[mps_cpu]; - if(clustered_apic_mode == CLUSTERED_APIC_NUMAQ) - return (mps_cpu/4)*16 + (1<<(mps_cpu%4)); - return mps_cpu; + switch (clustered_apic_mode) { + case CLUSTERED_APIC_XAPIC: + if (mps_cpu >= NR_CPUS) + return BAD_APICID; + else + return raw_phys_apicid[mps_cpu]; + case CLUSTERED_APIC_NUMAQ: + return (mps_cpu & ~0x3) << 2 | 1 << (mps_cpu & 0x3); + case CLUSTERED_APIC_NONE: + default: + return mps_cpu; + } } static inline unsigned long apicid_to_phys_cpu_present(int apicid) _ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |