]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
x86/hvm/dmop: fix EFAULT condition
authorWei Liu <wei.liu2@citrix.com>
Thu, 28 Sep 2017 09:34:55 +0000 (10:34 +0100)
committerWei Liu <wei.liu2@citrix.com>
Thu, 28 Sep 2017 10:57:21 +0000 (11:57 +0100)
The copy macro returns false when the copy fails.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/dm.c

index 87ef4b6ca998e3892684c1f305e739587effaee0..9cf53b551c7db8b3135cd17b98e742e5d9e4e604 100644 (file)
@@ -178,11 +178,9 @@ static int modified_memory(struct domain *d,
         struct xen_dm_op_modified_memory_extent extent;
         unsigned int batch_nr;
         xen_pfn_t pfn, end_pfn;
-        int rc;
 
-        rc = COPY_FROM_GUEST_BUF_OFFSET(extent,
-            bufs, EXTENTS_BUFFER, (*rem_extents - 1) * sizeof(extent));
-        if ( rc )
+        if ( !COPY_FROM_GUEST_BUF_OFFSET(extent, bufs, EXTENTS_BUFFER,
+                                         (*rem_extents - 1) * sizeof(extent)) )
             return -EFAULT;
 
         if ( extent.pad )