aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/event_channel.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2012-12-10 11:18:25 +0100
committerJan Beulich <jbeulich@suse.com>2012-12-10 11:18:25 +0100
commite93e0d9d73ce77bd1f3471af68a194b47e0e8c45 (patch)
treebe7768d89381228bc3ed5f4867db23f631a78054 /xen/common/event_channel.c
parentedaa3f893f8f046e05099bc0d087b276a90451d4 (diff)
downloadxen-e93e0d9d73ce77bd1f3471af68a194b47e0e8c45.tar.gz
xen-e93e0d9d73ce77bd1f3471af68a194b47e0e8c45.tar.bz2
xen-e93e0d9d73ce77bd1f3471af68a194b47e0e8c45.zip
streamline guest copy operations
- use the variants not validating the VA range when writing back structures/fields to the same space that they were previously read from - when only a single field of a structure actually changed, copy back just that field where possible - consolidate copying back results in a few places Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/event_channel.c')
-rw-r--r--xen/common/event_channel.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index a80a0d1fcd..89f0ca7620 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -981,7 +981,7 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
if ( copy_from_guest(&alloc_unbound, arg, 1) != 0 )
return -EFAULT;
rc = evtchn_alloc_unbound(&alloc_unbound);
- if ( (rc == 0) && (copy_to_guest(arg, &alloc_unbound, 1) != 0) )
+ if ( !rc && __copy_to_guest(arg, &alloc_unbound, 1) )
rc = -EFAULT; /* Cleaning up here would be a mess! */
break;
}
@@ -991,7 +991,7 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
if ( copy_from_guest(&bind_interdomain, arg, 1) != 0 )
return -EFAULT;
rc = evtchn_bind_interdomain(&bind_interdomain);
- if ( (rc == 0) && (copy_to_guest(arg, &bind_interdomain, 1) != 0) )
+ if ( !rc && __copy_to_guest(arg, &bind_interdomain, 1) )
rc = -EFAULT; /* Cleaning up here would be a mess! */
break;
}
@@ -1001,7 +1001,7 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
if ( copy_from_guest(&bind_virq, arg, 1) != 0 )
return -EFAULT;
rc = evtchn_bind_virq(&bind_virq);
- if ( (rc == 0) && (copy_to_guest(arg, &bind_virq, 1) != 0) )
+ if ( !rc && __copy_to_guest(arg, &bind_virq, 1) )
rc = -EFAULT; /* Cleaning up here would be a mess! */
break;
}
@@ -1011,7 +1011,7 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
if ( copy_from_guest(&bind_ipi, arg, 1) != 0 )
return -EFAULT;
rc = evtchn_bind_ipi(&bind_ipi);
- if ( (rc == 0) && (copy_to_guest(arg, &bind_ipi, 1) != 0) )
+ if ( !rc && __copy_to_guest(arg, &bind_ipi, 1) )
rc = -EFAULT; /* Cleaning up here would be a mess! */
break;
}
@@ -1021,7 +1021,7 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
if ( copy_from_guest(&bind_pirq, arg, 1) != 0 )
return -EFAULT;
rc = evtchn_bind_pirq(&bind_pirq);
- if ( (rc == 0) && (copy_to_guest(arg, &bind_pirq, 1) != 0) )
+ if ( !rc && __copy_to_guest(arg, &bind_pirq, 1) )
rc = -EFAULT; /* Cleaning up here would be a mess! */
break;
}
@@ -1047,7 +1047,7 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
if ( copy_from_guest(&status, arg, 1) != 0 )
return -EFAULT;
rc = evtchn_status(&status);
- if ( (rc == 0) && (copy_to_guest(arg, &status, 1) != 0) )
+ if ( !rc && __copy_to_guest(arg, &status, 1) )
rc = -EFAULT;
break;
}