All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Wei Liu <wei.liu2@citrix.com>, Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [PATCH 2/3] libxl: use libxl__read_xenstore_check in vdispl function
Date: Mon, 18 Sep 2017 11:54:29 +0100	[thread overview]
Message-ID: <20170918105430.20543-3-wei.liu2@citrix.com> (raw)
In-Reply-To: <20170918105430.20543-1-wei.liu2@citrix.com>

Coverity-ID: 1418097

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_vdispl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_vdispl.c b/tools/libxl/libxl_vdispl.c
index 5740c89fad..cfee0f5cdf 100644
--- a/tools/libxl/libxl_vdispl.c
+++ b/tools/libxl/libxl_vdispl.c
@@ -40,10 +40,13 @@ static int libxl__vdispl_from_xenstore(libxl__gc *gc, const char *libxl_path,
                                        libxl_devid devid,
                                        libxl_device_vdispl *vdispl)
 {
-    char *be_path;
+    const char *be_path;
+    int rc;
 
     vdispl->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;
 
     return libxl__backendpath_parse_domid(gc, be_path, &vdispl->backend_domid);
 }
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-09-18 10:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 10:54 [PATCH 0/3] Some coverity fixes for xl/libxl Wei Liu
2017-09-18 10:54 ` [PATCH 1/3] libxl: use libxl__read_xenstore_check in vtpm function Wei Liu
2017-09-18 10:54 ` Wei Liu [this message]
2017-09-18 10:54 ` [PATCH 3/3] xl: avoid leaking memory in vdispl parser Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170918105430.20543-3-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.