[xen stable-4.9] x86/hvm/dmop: fix EFAULT condition

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.9] x86/hvm/dmop: fix EFAULT condition

patchbot
commit 5237ff8995ac3be0bec89f71948d5f3c81bd8b89
Author:     Wei Liu <[hidden email]>
AuthorDate: Tue Oct 24 16:08:22 2017 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Tue Oct 24 16:08:22 2017 +0200

    x86/hvm/dmop: fix EFAULT condition
   
    The copy macro returns false when the copy fails.
   
    Signed-off-by: Wei Liu <[hidden email]>
    Reviewed-by: Paul Durrant <[hidden email]>
    Reviewed-by: Andrew Cooper <[hidden email]>
    master commit: 1c2ea5ee05f6a046c458e5a0babbd72234b2526d
    master date: 2017-09-28 11:57:21 +0100
---
 xen/arch/x86/hvm/dm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index 4cf6dee..a2f303a 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -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 )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog