diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-06 10:42:32 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-06 10:42:32 +0100 |
commit | e926a106968c31292ed850b60197fb9af112d69e (patch) | |
tree | dc8baf168f1faf1b289426ca0d0417e10566da1e /tools/libxc/xc_evtchn.c | |
parent | 993adabd0023db2efd8e9b980501a4fbf55e1e3f (diff) | |
download | xen-e926a106968c31292ed850b60197fb9af112d69e.tar.gz xen-e926a106968c31292ed850b60197fb9af112d69e.tar.bz2 xen-e926a106968c31292ed850b60197fb9af112d69e.zip |
Ensure that all fields of evtchn_op_t are initialised when
making an event_channel_op hypercall. Stefan Berger gets the
credit for diagnosing nasty domU driver problems that were a
result of garbage fields.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/libxc/xc_evtchn.c')
-rw-r--r-- | tools/libxc/xc_evtchn.c | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c index 3bdacf36a3..ed6256654b 100644 --- a/tools/libxc/xc_evtchn.c +++ b/tools/libxc/xc_evtchn.c @@ -37,13 +37,12 @@ int xc_evtchn_alloc_unbound(int xc_handle, u32 dom, int *port) { - evtchn_op_t op; int rc; - - op.cmd = EVTCHNOP_alloc_unbound; - op.u.alloc_unbound.remote_dom = (domid_t)remote_dom; - op.u.alloc_unbound.dom = (domid_t)dom; - op.u.alloc_unbound.port = (port != NULL) ? *port : 0; + evtchn_op_t op = { + .cmd = EVTCHNOP_alloc_unbound, + .u.alloc_unbound.remote_dom = (domid_t)remote_dom, + .u.alloc_unbound.dom = (domid_t)dom, + .u.alloc_unbound.port = (port != NULL) ? *port : 0 }; if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 ) { @@ -61,15 +60,13 @@ int xc_evtchn_bind_interdomain(int xc_handle, int *port1, int *port2) { - evtchn_op_t op; int rc; - - op.cmd = EVTCHNOP_bind_interdomain; - op.u.bind_interdomain.dom1 = (domid_t)dom1; - op.u.bind_interdomain.dom2 = (domid_t)dom2; - op.u.bind_interdomain.port1 = (port1 != NULL) ? *port1 : 0; - op.u.bind_interdomain.port2 = (port2 != NULL) ? *port2 : 0; - + evtchn_op_t op = { + .cmd = EVTCHNOP_bind_interdomain, + .u.bind_interdomain.dom1 = (domid_t)dom1, + .u.bind_interdomain.dom2 = (domid_t)dom2, + .u.bind_interdomain.port1 = (port1 != NULL) ? *port1 : 0, + .u.bind_interdomain.port2 = (port2 != NULL) ? *port2 : 0 }; if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 ) { @@ -87,12 +84,11 @@ int xc_evtchn_bind_virq(int xc_handle, int virq, int *port) { - evtchn_op_t op; int rc; - - op.cmd = EVTCHNOP_bind_virq; - op.u.bind_virq.virq = (u32)virq; - op.u.bind_virq.vcpu = 0; + evtchn_op_t op = { + .cmd = EVTCHNOP_bind_virq, + .u.bind_virq.virq = (u32)virq, + .u.bind_virq.vcpu = 0 }; if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 ) { @@ -108,10 +104,10 @@ int xc_evtchn_close(int xc_handle, u32 dom, int port) { - evtchn_op_t op; - op.cmd = EVTCHNOP_close; - op.u.close.dom = (domid_t)dom; - op.u.close.port = port; + evtchn_op_t op = { + .cmd = EVTCHNOP_close, + .u.close.dom = (domid_t)dom, + .u.close.port = port }; return do_evtchn_op(xc_handle, &op); } @@ -119,9 +115,9 @@ int xc_evtchn_close(int xc_handle, int xc_evtchn_send(int xc_handle, int local_port) { - evtchn_op_t op; - op.cmd = EVTCHNOP_send; - op.u.send.local_port = local_port; + evtchn_op_t op = { + .cmd = EVTCHNOP_send, + .u.send.local_port = local_port }; return do_evtchn_op(xc_handle, &op); } @@ -131,13 +127,12 @@ int xc_evtchn_status(int xc_handle, int port, xc_evtchn_status_t *status) { - evtchn_op_t op; int rc; + evtchn_op_t op = { + .cmd = EVTCHNOP_status, + .u.status.dom = (domid_t)dom, + .u.status.port = port }; - op.cmd = EVTCHNOP_status; - op.u.status.dom = (domid_t)dom; - op.u.status.port = port; - if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 ) memcpy(status, &op.u.status, sizeof(*status)); |