[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/3] libxl: use libxl__read_xenstore_check in vtpm function
libxl__read_xenstore can return NULL. Use the _checked variant to return early when the read fails. Coverity-ID: 1418098 Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl_vtpm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_vtpm.c b/tools/libxl/libxl_vtpm.c index 21320870d4..bdbeb1b53b 100644 --- a/tools/libxl/libxl_vtpm.c +++ b/tools/libxl/libxl_vtpm.c @@ -79,12 +79,14 @@ static int libxl__vtpm_from_xenstore(libxl__gc *gc, const char *libxl_path, libxl_device_vtpm *vtpm) { int rc; - char *be_path; + const char *be_path; char *uuid; vtpm->devid = devid; - be_path = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/backend", libxl_path)); + rc = libxl__xs_read_checked(gc, XBT_NULL, + GCSPRINTF("%s/backend", libxl_path), &be_path); + if (rc) return rc; rc = libxl__backendpath_parse_domid(gc, be_path, &vtpm->backend_domid); if (rc) return rc; -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |