tools/libxc: Set max_elem to zero in xc_lockprof_query_number()
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Wed, 13 Aug 2014 16:40:38 +0000 (12:40 -0400)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 26 Aug 2014 21:03:17 +0000 (22:03 +0100)
If max_elem is not zero then hypervisor's spinlock_profile_ucopy_elem()
will attempt to copy profile data into user's data buffer. Since this
buffer is explicitly set to (the equivalent of) NULL the copy will fail,
causing xenlockprof to fail as well.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxc/xc_misc.c

index 4143de60a3439bdd8e3789ed00b1257ee21a0a18..e253a58b9b4f49bab63e8516ce64e6930283e1dd 100644 (file)
@@ -320,6 +320,7 @@ int xc_lockprof_query_number(xc_interface *xch,
     DECLARE_SYSCTL;
 
     sysctl.cmd = XEN_SYSCTL_lockprof_op;
+    sysctl.u.lockprof_op.max_elem = 0;
     sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_query;
     set_xen_guest_handle(sysctl.u.lockprof_op.data, HYPERCALL_BUFFER_NULL);