]> xenbits.xensource.com Git - xen.git/commitdiff
x86/hvm/dmop: fix EFAULT condition
authorWei Liu <wei.liu2@citrix.com>
Tue, 24 Oct 2017 14:08:22 +0000 (16:08 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 24 Oct 2017 14:08:22 +0000 (16:08 +0200)
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>
master commit: 1c2ea5ee05f6a046c458e5a0babbd72234b2526d
master date: 2017-09-28 11:57:21 +0100

xen/arch/x86/hvm/dm.c

index 4cf6deedc72818904289158e5f110566e592cbef..a2f303a9db469654ef29b4747014d8d099cca44d 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 )