From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
xen-devel <xen-devel@lists.xenproject.org>,
Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH] libxl: don't leave libxl_set_memory_target() return value uninitialized
Date: Mon, 20 Jun 2016 11:08:20 +0100 [thread overview]
Message-ID: <20160620100820.GM28116@citrix.com> (raw)
In-Reply-To: <5767DC3802000078000F6930@prv-mh.provo.novell.com>
On Mon, Jun 20, 2016 at 04:06:16AM -0600, Jan Beulich wrote:
> Commit ecdc6fd878 ("libxl: Fix libxl_set_memory_target return value")
> deliberately made rc an uninitialized variable, but left a code path in
> place where the variable doesn't get initialized. Use ERROR_INVAL in
> this case to match behavior prior to that patch; arguably ERROR_FAIL
> might be more appropriate.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> Did Coverity not spot this yet?
>
Yes, I already sent a patch. But no-one reviewed it yet... :-/
<1465740590-21337-1-git-send-email-wei.liu2@citrix.com>
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -4927,8 +4927,10 @@ retry_transaction:
>
> target = libxl__xs_read(gc, t, GCSPRINTF("%s/memory/target", dompath));
> if (!target && !domid) {
> - if (!xs_transaction_end(ctx->xsh, t, 1))
> + if (!xs_transaction_end(ctx->xsh, t, 1)) {
> + rc = ERROR_INVAL;
> goto out_no_transaction;
> + }
> lrc = libxl__fill_dom0_memory_info(gc, ¤t_target_memkb,
> ¤t_max_memkb);
> if (lrc < 0) { rc = ERROR_FAIL; goto out_no_transaction; }
>
>
>
> libxl: don't leave libxl_set_memory_target() return value uninitialized
>
> Commit ecdc6fd878 ("libxl: Fix libxl_set_memory_target return value")
> deliberately made rc an uninitialized variable, but left a code path in
> place where the variable doesn't get initialized. Use ERROR_INVAL in
> this case to match behavior prior to that patch; arguably ERROR_FAIL
> might be more appropriate.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> Did Coverity not spot this yet?
>
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -4927,8 +4927,10 @@ retry_transaction:
>
> target = libxl__xs_read(gc, t, GCSPRINTF("%s/memory/target", dompath));
> if (!target && !domid) {
> - if (!xs_transaction_end(ctx->xsh, t, 1))
> + if (!xs_transaction_end(ctx->xsh, t, 1)) {
> + rc = ERROR_INVAL;
> goto out_no_transaction;
> + }
> lrc = libxl__fill_dom0_memory_info(gc, ¤t_target_memkb,
> ¤t_max_memkb);
> if (lrc < 0) { rc = ERROR_FAIL; goto out_no_transaction; }
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
prev parent reply other threads:[~2016-06-20 10:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 10:06 [PATCH] libxl: don't leave libxl_set_memory_target() return value uninitialized Jan Beulich
2016-06-20 10:08 ` Wei Liu [this message]
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=20160620100820.GM28116@citrix.com \
--to=wei.liu2@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.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).