ia64/xen-unstable

changeset 16670:4624795a2346

hvm: copy_{to,from}_user_hvm shoudl return appropriate error codes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Dec 27 23:01:50 2007 +0000 (2007-12-27)
parents 7fbc521b07a9
children 19f549449cb5
files xen/arch/x86/hvm/platform.c
line diff
     1.1 --- a/xen/arch/x86/hvm/platform.c	Thu Dec 27 13:00:40 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/platform.c	Thu Dec 27 23:01:50 2007 +0000
     1.3 @@ -1310,26 +1310,30 @@ DEFINE_PER_CPU(int, guest_handles_in_xen
     1.4     deal with this. */
     1.5  unsigned long copy_to_user_hvm(void *to, const void *from, unsigned len)
     1.6  {
     1.7 +    int rc;
     1.8 +
     1.9      if ( this_cpu(guest_handles_in_xen_space) )
    1.10      {
    1.11          memcpy(to, from, len);
    1.12          return 0;
    1.13      }
    1.14  
    1.15 -    return hvm_copy_to_guest_virt_nofault(
    1.16 -        (unsigned long)to, (void *)from, len);
    1.17 +    rc = hvm_copy_to_guest_virt_nofault((unsigned long)to, (void *)from, len);
    1.18 +    return rc ? len : 0; /* fake a copy_to_user() return code */
    1.19  }
    1.20  
    1.21  unsigned long copy_from_user_hvm(void *to, const void *from, unsigned len)
    1.22  {
    1.23 +    int rc;
    1.24 +
    1.25      if ( this_cpu(guest_handles_in_xen_space) )
    1.26      {
    1.27          memcpy(to, from, len);
    1.28          return 0;
    1.29      }
    1.30  
    1.31 -    return hvm_copy_from_guest_virt_nofault(
    1.32 -        to, (unsigned long)from, len);
    1.33 +    rc = hvm_copy_from_guest_virt_nofault(to, (unsigned long)from, len);
    1.34 +    return rc ? len : 0; /* fake a copy_from_user() return code */
    1.35  }
    1.36  
    1.37  /*