]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
xen/i386: follow-up to c/s 1101
authorJan Beulich <jbeulich@novell.com>
Fri, 19 Aug 2011 08:53:47 +0000 (09:53 +0100)
committerJan Beulich <jbeulich@novell.com>
Fri, 19 Aug 2011 08:53:47 +0000 (09:53 +0100)
The numbers obtained from the hypervisor really can't ever lead to an
overflow here, only the original calculation going through the order
of the range could have. This avoids the (as Jeremy points outs)
somewhat ugly NULL-based calculation here.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
arch/i386/mach-xen/setup.c

index 40a510cdae0f2d3432b2844110fe6765c112e798..b3f4903ce672a356759aa41edbdf2e26a93a4d09 100644 (file)
@@ -110,10 +110,8 @@ void __init pre_setup_arch_hook(void)
                machine_to_phys_nr = mapping.max_mfn + 1;
        } else
                machine_to_phys_nr = MACH2PHYS_NR_ENTRIES;
-       if (machine_to_phys_mapping + machine_to_phys_nr
-           < machine_to_phys_mapping)
-               machine_to_phys_nr = (unsigned long *)NULL
-                                    - machine_to_phys_mapping;
+       WARN_ON(machine_to_phys_mapping + (machine_to_phys_nr - 1)
+               < machine_to_phys_mapping);
 
        if (!xen_feature(XENFEAT_auto_translated_physmap))
                phys_to_machine_mapping =