On Wed, 20 Feb 2013, Armin Steinhoff wrote: > after a walk through the module "io_apic.c" in > "/usr/src/linux/arch/x86/kernel/apic" I got the impression that the variable > "nr_ioapics" is used but isn't initialized ! > Could it be the source of boot problems ? Well no, unless your compiler is silly. arch/x86/kernel/apic/io_apic.c:int nr_ioapics; That's initialized to 0 > Dangerous coding stile in "static struct resource * __init > ioapic_setup_resources(int nr_ioapics)" .... Though the brilliant brain who decided to name the argument of ioapic_setup_resources() the same as a global variable and of course the call site of it to do: ioapic_res = ioapic_setup_resources(nr_ioapics); Brilliant. Unfortunately that's completely correct C code. Though it's confusing as hell and definitely worth to be fixed. Patch below. Thanks, tglx Index: linux-2.6/arch/x86/kernel/apic/io_apic.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c +++ linux-2.6/arch/x86/kernel/apic/io_apic.c @@ -3637,25 +3637,25 @@ void __init setup_ioapic_dest(void) static struct resource *ioapic_resources; -static struct resource * __init ioapic_setup_resources(int nr_ioapics) +static struct resource * __init ioapic_setup_resources(int cnt) { unsigned long n; struct resource *res; char *mem; int i; - if (nr_ioapics <= 0) + if (cnt <= 0) return NULL; n = IOAPIC_RESOURCE_NAME_SIZE + sizeof(struct resource); - n *= nr_ioapics; + n *= cnt; mem = alloc_bootmem(n); res = (void *)mem; - mem += sizeof(struct resource) * nr_ioapics; + mem += sizeof(struct resource) * cnt; - for (i = 0; i < nr_ioapics; i++) { + for (i = 0; i < cnt; i++) { res[i].name = mem; res[i].flags = IORESOURCE_MEM | IORESOURCE_BUSY; snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i); -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html