From: Jan Beulich Date: Wed, 28 Jan 2015 15:32:01 +0000 (+0100) Subject: kexec: prefer __copy_to_guest() when possible X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3824 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c2ba001caf5125412bb82325f8a21f3eacf17958;p=xen.git 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 Acked-by: David Vrabel --- diff --git a/xen/common/kexec.c b/xen/common/kexec.c index 05d5de7a75..3b4275e736 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;