# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1198796510 0
# Node ID 4624795a2346438bab8115b6a5eac7218be9e6d9
# Parent 7fbc521b07a918512a62dee712e3c2b1f228f8e0
hvm: copy_{to,from}_user_hvm shoudl return appropriate error codes.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
xen/arch/x86/hvm/platform.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff -r 7fbc521b07a9 -r 4624795a2346 xen/arch/x86/hvm/platform.c
--- a/xen/arch/x86/hvm/platform.c Thu Dec 27 13:00:40 2007 +0000
+++ b/xen/arch/x86/hvm/platform.c Thu Dec 27 23:01:50 2007 +0000
@@ -1310,26 +1310,30 @@ DEFINE_PER_CPU(int, guest_handles_in_xen
deal with this. */
unsigned long copy_to_user_hvm(void *to, const void *from, unsigned len)
{
+ int rc;
+
if ( this_cpu(guest_handles_in_xen_space) )
{
memcpy(to, from, len);
return 0;
}
- return hvm_copy_to_guest_virt_nofault(
- (unsigned long)to, (void *)from, len);
+ rc = hvm_copy_to_guest_virt_nofault((unsigned long)to, (void *)from, len);
+ return rc ? len : 0; /* fake a copy_to_user() return code */
}
unsigned long copy_from_user_hvm(void *to, const void *from, unsigned len)
{
+ int rc;
+
if ( this_cpu(guest_handles_in_xen_space) )
{
memcpy(to, from, len);
return 0;
}
- return hvm_copy_from_guest_virt_nofault(
- to, (unsigned long)from, len);
+ rc = hvm_copy_from_guest_virt_nofault(to, (unsigned long)from, len);
+ return rc ? len : 0; /* fake a copy_from_user() return code */
}
/*
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|