]> xenbits.xensource.com Git - xen.git/commitdiff
Clean up and fix XEN_SYSCTL_getcpuinfo error path.
authorKeir Fraser <keir@xensource.com>
Tue, 2 Oct 2007 09:45:53 +0000 (10:45 +0100)
committerKeir Fraser <keir@xensource.com>
Tue, 2 Oct 2007 09:45:53 +0000 (10:45 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/sysctl.c

index 39d0d8c31dd8d3ac38d92e70140ed8ec2576a8b9..cde2ca8b36c4ce2e26bd888ed2c75d225b9898a5 100644 (file)
@@ -177,18 +177,13 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
             if ( v->is_running )
                 cpuinfo.idletime += NOW() - v->runstate.state_entry_time;
 
+            ret = -EFAULT;
             if ( copy_to_guest_offset(op->u.getcpuinfo.info, i, &cpuinfo, 1) )
-            {
-                ret = -EFAULT;
-                break;
-            }
+                goto out;
         }
 
         op->u.getcpuinfo.nr_cpus = i;
-        ret = 0;
-
-        if ( copy_to_guest(u_sysctl, op, 1) )
-            ret = -EFAULT;
+        ret = copy_to_guest(u_sysctl, op, 1) ? -EFAULT : 0;
     }
     break;
 
@@ -209,6 +204,7 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
         break;
     }
 
+ out:
     spin_unlock(&sysctl_lock);
 
     return ret;