]> xenbits.xensource.com Git - people/aperard/xen-arm.git/commitdiff
memop: adjust error checking in populate_physmap()
authorJan Beulich <jbeulich@suse.com>
Thu, 6 Dec 2012 13:19:15 +0000 (14:19 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 6 Dec 2012 13:19:15 +0000 (14:19 +0100)
Checking that multi-page allocations are permitted is unnecessary for
PoD population operations. Instead, the (loop invariant) check added
for addressing XSA-31 can be moved here.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/common/memory.c

index a076f81afeb34657c4b043e13474659169bbad2c..a88348f802ac84ce7f0ff32fa80a543dea1c7551 100644 (file)
@@ -99,7 +99,8 @@ static void populate_physmap(struct memop_args *a)
                                      a->nr_extents-1) )
         return;
 
-    if ( !multipage_allocation_permitted(current->domain, a->extent_order) )
+    if ( a->memflags & MEMF_populate_on_demand ? a->extent_order > MAX_ORDER :
+         !multipage_allocation_permitted(current->domain, a->extent_order) )
         return;
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
@@ -115,8 +116,7 @@ static void populate_physmap(struct memop_args *a)
 
         if ( a->memflags & MEMF_populate_on_demand )
         {
-            if ( a->extent_order > MAX_ORDER ||
-                 guest_physmap_mark_populate_on_demand(d, gpfn,
+            if ( guest_physmap_mark_populate_on_demand(d, gpfn,
                                                        a->extent_order) < 0 )
                 goto out;
         }