x86/apic: Fix signedness bug in APIC ID validity checks
[sfrench/cifs-2.6.git] / arch / x86 / kernel / acpi / boot.c
index 2aa92094b59d4fb6f3fffa8c0a920eb8023f6d45..5ee33a6e33bbbaa5b4ee0f6f445a1f78f6fefdcd 100644 (file)
@@ -200,7 +200,7 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
 {
        struct acpi_madt_local_x2apic *processor = NULL;
 #ifdef CONFIG_X86_X2APIC
-       int apic_id;
+       u32 apic_id;
        u8 enabled;
 #endif
 
@@ -222,10 +222,13 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
         * to not preallocating memory for all NR_CPUS
         * when we use CPU hotplug.
         */
-       if (!apic->apic_id_valid(apic_id) && enabled)
-               printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
-       else
-               acpi_register_lapic(apic_id, processor->uid, enabled);
+       if (!apic->apic_id_valid(apic_id)) {
+               if (enabled)
+                       pr_warn(PREFIX "x2apic entry ignored\n");
+               return 0;
+       }
+
+       acpi_register_lapic(apic_id, processor->uid, enabled);
 #else
        printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
 #endif