WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] linux-2.6.18/i386: follow-up to c/s 1101

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux-2.6.18/i386: follow-up to c/s 1101
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Wed, 17 Aug 2011 08:49:36 +0100
Delivery-date: Wed, 17 Aug 2011 00:49:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxx>

--- a/arch/i386/mach-xen/setup.c
+++ b/arch/i386/mach-xen/setup.c
@@ -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 =



Attachment: xen-i386-m2p-no-overflow.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux-2.6.18/i386: follow-up to c/s 1101, Jan Beulich <=