All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: xen-devel@lists.xen.org, ayush ruia <ayushruia@gmail.com>
Subject: Re: Possible bug in tools/libxl/libxl.c -- Variable passed by reference not set in one possible case
Date: Fri, 10 Oct 2014 10:17:15 +0100	[thread overview]
Message-ID: <1412932635.10650.22.camel@citrix.com> (raw)
In-Reply-To: <20141010090611.GB4880@zion.uk.xensource.com>

On Fri, 2014-10-10 at 10:06 +0100, Wei Liu wrote:
> Please send plain text email in the future. Some (if not all) developers
> only have very shabby text editor to read / reply to your email. ;-)
> 
> On Thu, Oct 09, 2014 at 08:28:53PM -0500, ayush ruia wrote:
> > What I am trying to say is that shouldn't the code block highlighted in
> > yellow should come before the block marked in green. Then it would update
> > the value of *target_memkb and *max_memkb in all possible situations.
> > 
> 
> I don't think so. This function means "if there's no such values in
> xenstore then retrieve them from hypervisor and fill them in xenstore,
> optionally return those values to the caller".
> 
> So if those values already are present in xenstore this function doesn't
> need to do anything.

If I call this function and receive a return code of zero how can I tell
if the target_memkb pointer I passed has been initialised or not?

If all of target, staticmax and freememslack are already set the
function returns 0 without updating those pointers, so I don't think we
can tell.

It does seem like the 
 if (target && staticmax && freememslack) {
        rc = 0;
        goto out;
    }
belongs after the code which writes back the two variables.

Ian.

  reply	other threads:[~2014-10-10  9:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-10  1:07 Possible bug in tools/libxl/libxl.c -- Variable passed by reference not set in one possible case ayush ruia
2014-10-10  1:28 ` ayush ruia
2014-10-10  9:06   ` Wei Liu
2014-10-10  9:17     ` Ian Campbell [this message]
2014-10-10  9:24       ` Wei Liu
2014-10-10  9:30         ` Ian Campbell
2014-10-10 10:54           ` Wei Liu
2014-10-10 11:30             ` Ian Campbell
2014-10-10 12:43               ` ayush ruia
2014-10-10 13:58                 ` Wei Liu
2014-10-10 14:47                   ` ayush ruia
2014-10-10 15:27                     ` Ian Campbell
2014-10-10 16:41                       ` ayush ruia
2014-10-10 16:55                         ` Ian Campbell

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=1412932635.10650.22.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ayushruia@gmail.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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.