|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxl: properly initialize device structures
commit 26c35e5cb93a7b4dcde940620eb7ac1845ed6e5a
Author: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
AuthorDate: Fri Apr 12 11:22:26 2013 -0400
Commit: Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Wed Apr 17 14:56:27 2013 +0100
libxl: properly initialize device structures
This avoids returning unallocated memory in the libxl_device_vtpm
structure in libxl_device_vtpm_list, and uses libxl_device_nic_init
instead of memset when initializing libxl_device_nics.
Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
tools/libxl/libxl.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index fa6dfed..0f936c0 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1850,6 +1850,8 @@ libxl_device_vtpm *libxl_device_vtpm_list(libxl_ctx *ctx,
uint32_t domid, int *n
GCSPRINTF("%s/%s/backend",
fe_path, *dir));
+ libxl_device_vtpm_init(vtpm);
+
vtpm->devid = atoi(*dir);
tmp = libxl__xs_read(gc, XBT_NULL,
@@ -1953,7 +1955,7 @@ int libxl_devid_to_device_vtpm(libxl_ctx *ctx,
if (!vtpms)
return ERROR_FAIL;
- memset(vtpm, 0, sizeof (libxl_device_vtpm));
+ libxl_device_vtpm_init(vtpm);
rc = 1;
for (i = 0; i < nb; ++i) {
if(devid == vtpms[i].devid) {
@@ -2932,7 +2934,7 @@ static void libxl__device_nic_from_xs_be(libxl__gc *gc,
char *tmp;
int rc;
- memset(nic, 0, sizeof(*nic));
+ libxl_device_nic_init(nic);
tmp = xs_read(ctx->xsh, XBT_NULL,
libxl__sprintf(gc, "%s/handle", be_path), &len);
@@ -2971,7 +2973,7 @@ int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t
domid,
char *dompath, *path;
int rc = ERROR_FAIL;
- memset(nic, 0, sizeof (libxl_device_nic));
+ libxl_device_nic_init(nic);
dompath = libxl__xs_get_dompath(gc, domid);
if (!dompath)
goto out;
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |