common/sysctl: Don't leak status in SYSCTL_page_offline_op
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 20 Jan 2014 08:48:11 +0000 (09:48 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 20 Jan 2014 08:48:11 +0000 (09:48 +0100)
In addition, 'copyback' should be cleared even in the error case.

Also fix the indentation of the arguments to copy_to_guest() to help clarify
that the 'ret = -EFAULT' is not part of the condition.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/common/sysctl.c

index 117e095a35255f4c7ab0aa76458c39cc0b177148..0cb6ee15fb59c21596d1ade90f35d72ef09e9107 100644 (file)
@@ -230,12 +230,9 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
         }
 
         if ( copy_to_guest(
-            op->u.page_offline.status, status,
-            op->u.page_offline.end - op->u.page_offline.start + 1) )
-        {
+                 op->u.page_offline.status, status,
+                 op->u.page_offline.end - op->u.page_offline.start + 1) )
             ret = -EFAULT;
-            break;
-        }
 
         xfree(status);
         copyback = 0;