[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] kexec: prefer __copy_to_guest() when possible



commit c2ba001caf5125412bb82325f8a21f3eacf17958
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jan 28 16:32:01 2015 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 28 16:32:01 2015 +0100

    kexec: prefer __copy_to_guest() when possible
    
    It's slightly cheaper and safe as long a copy_from_guest() for the same
    guest address range was issued before.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: David Vrabel <david.vrabel@xxxxxxxxxx>
---
 xen/common/kexec.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/common/kexec.c b/xen/common/kexec.c
index 05d5de7..3b4275e 100644
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -662,8 +662,8 @@ static int kexec_get_range(XEN_GUEST_HANDLE_PARAM(void) 
uarg)
 
     ret = kexec_get_range_internal(&range);
 
-    if ( ret == 0 && unlikely(copy_to_guest(uarg, &range, 1)) )
-        return -EFAULT;
+    if ( ret == 0 && unlikely(__copy_to_guest(uarg, &range, 1)) )
+        ret = -EFAULT;
 
     return ret;
 }
@@ -686,10 +686,11 @@ static int 
kexec_get_range_compat(XEN_GUEST_HANDLE_PARAM(void) uarg)
     if ( (range.start | range.size) & ~(unsigned long)(~0u) )
         return -ERANGE;
 
-    if ( ret == 0 ) {
+    if ( ret == 0 )
+    {
         XLAT_kexec_range(&compat_range, &range);
-        if ( unlikely(copy_to_guest(uarg, &compat_range, 1)) )
-             return -EFAULT;
+        if ( unlikely(__copy_to_guest(uarg, &compat_range, 1)) )
+             ret = -EFAULT;
     }
 
     return ret;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.