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: jbeulich@suse.com, Andrew Cooper <andrew.cooper3@citrix.com>,
	dario.faggioli@citrix.com,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel@lists.xen.org, Elena Ufimtseva <ufimtseva@gmail.com>
Subject: Re: [PATCH v3 07/19] libxl: x86: factor out e820_host_sanitize
Date: Wed, 14 Jan 2015 11:40:42 +0000	[thread overview]
Message-ID: <1421235642.19103.227.camel@citrix.com> (raw)
In-Reply-To: <20150114103015.GW4226@zion.uk.xensource.com>

On Wed, 2015-01-14 at 10:30 +0000, Wei Liu wrote:
> On Tue, Jan 13, 2015 at 09:00:49PM +0000, Andrew Cooper wrote:
> > On 13/01/15 12:11, Wei Liu wrote:
> > > This function gets the machine E820 map and sanitize it according to PV
> > > guest configuration.
> > >
> > > This will be used in later patch. No functional change introduced in
> > > this patch.
> > >
> > > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > > Cc: Ian Campbell <ian.campbell@citrix.com>
> > > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > > Cc: Dario Faggioli <dario.faggioli@citrix.com>
> > > Cc: Elena Ufimtseva <ufimtseva@gmail.com>
> > > ---
> > >  tools/libxl/libxl_x86.c |   31 ++++++++++++++++++++++---------
> > >  1 file changed, 22 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
> > > index 9ceb373..e959e37 100644
> > > --- a/tools/libxl/libxl_x86.c
> > > +++ b/tools/libxl/libxl_x86.c
> > > @@ -207,6 +207,27 @@ static int e820_sanitize(libxl_ctx *ctx, struct e820entry src[],
> > >      return 0;
> > >  }
> > >  
> > > +static int e820_host_sanitize(libxl__gc *gc,
> > > +                              libxl_domain_build_info *b_info,
> > > +                              struct e820entry map[],
> > > +                              uint32_t *nr)
> > > +{
> > > +    int rc;
> > > +
> > > +    rc = xc_get_machine_memory_map(CTX->xch, map, E820MAX);
> > 
> > This function should not assume that map[] is E820MAX entries long.  The
> > code you copied was passing a local variable whereas here you are
> > passing someone else's pointer.  You should pass the length in *nr like
> > e820_sanitize() does.
> > 
> 
> Good catch. I will fix.

Does it also work to make the prototpe "map[E820MAX]" thereby causing
the compiler to force the caller to use a suitably sized array? (not
sure what the constraints on the caller are here, i.e. whether it needs
to be dynamically allocated.)

  reply	other threads:[~2015-01-14 11:40 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 12:11 [PATCH v3 00/19] Virtual NUMA for PV and HVM Wei Liu
2015-01-13 12:11 ` [PATCH v3 01/19] xen: dump vNUMA information with debug key "u" Wei Liu
2015-01-13 16:38   ` Jan Beulich
2015-01-13 16:45     ` Wei Liu
2015-01-13 19:21   ` Andrew Cooper
2015-01-13 20:51     ` Wei Liu
2015-01-14 11:06       ` Andrew Cooper
2015-01-14 11:24         ` Jan Beulich
2015-01-14 11:45           ` Andrew Cooper
2015-01-14 12:02             ` Wei Liu
2015-01-14 15:04               ` Jan Beulich
2015-01-14 14:49             ` Jan Beulich
2015-01-14 17:25               ` Wei Liu
2015-01-15  8:14                 ` Jan Beulich
2015-01-15 10:38                   ` Andrew Cooper
2015-01-13 12:11 ` [PATCH v3 02/19] xen: make two memory hypercalls vNUMA-aware Wei Liu
2015-01-13 12:11 ` [PATCH v3 03/19] libxc: allocate memory with vNUMA information for PV guest Wei Liu
2015-01-13 17:05   ` Ian Jackson
2015-01-13 17:41     ` Wei Liu
2015-01-13 20:02   ` Andrew Cooper
2015-01-14 10:53     ` Wei Liu
2015-01-14 10:58       ` Andrew Cooper
2015-01-14 11:01         ` Wei Liu
2015-01-13 12:11 ` [PATCH v3 04/19] libxl: introduce vNUMA types Wei Liu
2015-01-13 15:40   ` Ian Jackson
2015-01-13 15:51     ` Wei Liu
2015-01-13 12:11 ` [PATCH v3 05/19] libxl: add vmemrange to libxl__domain_build_state Wei Liu
2015-01-13 17:02   ` Ian Jackson
2015-01-13 17:34     ` Wei Liu
2015-01-13 12:11 ` [PATCH v3 06/19] libxl: introduce libxl__vnuma_config_check Wei Liu
2015-01-13 12:11 ` [PATCH v3 07/19] libxl: x86: factor out e820_host_sanitize Wei Liu
2015-01-13 17:07   ` Ian Jackson
2015-01-13 21:00   ` Andrew Cooper
2015-01-14 10:30     ` Wei Liu
2015-01-14 11:40       ` Ian Campbell [this message]
2015-01-14 12:05         ` Wei Liu
2015-01-13 12:11 ` [PATCH v3 08/19] libxl: functions to build vmemranges for PV guest Wei Liu
2015-01-13 18:15   ` Ian Jackson
2015-01-14 11:05     ` Wei Liu
2015-01-13 12:11 ` [PATCH v3 09/19] libxl: build, check and pass vNUMA info to Xen " Wei Liu
2015-01-13 12:11 ` [PATCH v3 10/19] xen: handle XENMEM_get_vnumainfo in compat_memory_op Wei Liu
2015-01-13 16:41   ` Jan Beulich
2015-01-13 12:11 ` [PATCH v3 11/19] tools/hvmloader: link errno.h from xen internal Wei Liu
2015-01-13 16:32   ` Jan Beulich
2015-01-13 16:36     ` Wei Liu
2015-01-13 12:11 ` [PATCH v3 12/19] hvmloader: retrieve vNUMA information from hypervisor Wei Liu
2015-01-13 16:50   ` Jan Beulich
2015-01-13 17:17     ` Wei Liu
2015-01-13 12:11 ` [PATCH v3 13/19] hvmloader: construct SRAT Wei Liu
2015-01-13 16:52   ` Jan Beulich
2015-01-13 12:11 ` [PATCH v3 14/19] hvmloader: construct SLIT Wei Liu
2015-01-13 16:53   ` Jan Beulich
2015-01-13 12:11 ` [PATCH v3 15/19] libxc: allocate memory with vNUMA information for HVM guest Wei Liu
2015-01-13 18:15   ` Konrad Rzeszutek Wilk
2015-01-13 20:44     ` Wei Liu
2015-01-14 19:02       ` Konrad Rzeszutek Wilk
2015-01-13 12:11 ` [PATCH v3 16/19] libxl: build, check and pass vNUMA info to Xen " Wei Liu
2015-01-13 12:11 ` [PATCH v3 17/19] libxl: disallow memory relocation when vNUMA is enabled Wei Liu
2015-01-13 12:11 ` [PATCH v3 18/19] libxlutil: nested list support Wei Liu
2015-01-13 15:52   ` Ian Jackson
2015-01-13 16:11     ` Wei Liu
2015-01-13 18:25       ` Ian Jackson
2015-01-13 12:11 ` [PATCH v3 19/19] xl: vNUMA support 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=1421235642.19103.227.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=ufimtseva@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.