From: Wei Liu <wei.liu2@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH for-4.6] libxl: fix libxl__build_hvm error code return path
Date: Tue, 11 Aug 2015 14:48:12 +0100 [thread overview]
Message-ID: <1439300892-6836-1-git-send-email-wei.liu2@citrix.com> (raw)
In 25652f23 ("tools/libxl: detect and avoid conflicts with RDM"), new
code was added to use rc to store libxl function call return value,
which complied to libxl coding style. That patch, however, didn't change
other locations where return value was stored in ret. In the end
libxl__build_hvm could return 0 when it failed.
Explicitly set rc to ERROR_FAIL in all error paths to fix this.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Roger Pau Monne <roger.pau@citrix.com>
---
tools/libxl/libxl_dom.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index e1f11a3..17ae4bd 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -966,12 +966,19 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
ret = libxl__vnuma_build_vmemrange_hvm(gc, domid, info, state, &args);
if (ret) {
LOGEV(ERROR, ret, "hvm build vmemranges failed");
+ rc = ERROR_FAIL;
goto out;
}
ret = libxl__vnuma_config_check(gc, info, state);
- if (ret) goto out;
+ if (ret) {
+ rc = ERROR_FAIL;
+ goto out;
+ }
ret = set_vnuma_info(gc, domid, info, state);
- if (ret) goto out;
+ if (ret) {
+ rc = ERROR_FAIL;
+ goto out;
+ }
args.nr_vmemranges = state->num_vmemranges;
args.vmemranges = libxl__malloc(gc, sizeof(*args.vmemranges) *
@@ -994,6 +1001,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
ret = xc_hvm_build(ctx->xch, domid, &args);
if (ret) {
LOGEV(ERROR, ret, "hvm building failed");
+ rc = ERROR_FAIL;
goto out;
}
@@ -1008,12 +1016,14 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
state->console_domid);
if (ret) {
LOGEV(ERROR, ret, "hvm build set params failed");
+ rc = ERROR_FAIL;
goto out;
}
ret = hvm_build_set_xs_values(gc, domid, &args);
if (ret) {
LOG(ERROR, "hvm build set xenstore values failed (ret=%d)", ret);
+ rc = ERROR_FAIL;
goto out;
}
--
2.1.4
next reply other threads:[~2015-08-11 13:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 13:48 Wei Liu [this message]
2015-08-11 13:55 ` [PATCH for-4.6] libxl: fix libxl__build_hvm error code return path Ian Campbell
2015-08-11 13:58 ` Wei Liu
2015-08-12 15:49 ` Ian Jackson
-- strict thread matches above, loose matches on Subject: below --
2015-08-07 16:08 Roger Pau Monne
2015-08-11 8:57 ` Wei Liu
2015-08-11 12:44 ` Ian Campbell
2015-08-11 12:48 ` 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=1439300892-6836-1-git-send-email-wei.liu2@citrix.com \
--to=wei.liu2@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=stefano.stabellini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).