xen/i386: follow-up to "replace order-based range checking of M2P table by linear...
authorJan Beulich <JBeulich@suse.com>
Thu, 15 Sep 2011 07:52:40 +0000 (08:52 +0100)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 15 Sep 2011 08:39:46 +0000 (04:39 -0400)
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>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
arch/x86/xen/mmu.c

index 24abc1f50dc5c671ae2e4a9973efd1d9762472a4..a3872f7632e880fb0a7e6312f5781e1df6ae1423 100644 (file)
@@ -1721,10 +1721,8 @@ void __init xen_setup_machphys_mapping(void)
                machine_to_phys_nr = MACH2PHYS_NR_ENTRIES;
        }
 #ifdef CONFIG_X86_32
-       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);
 #endif
 }