From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH for 4.6 v3 3/3] xl: handle empty vnuma configuration Date: Thu, 10 Sep 2015 16:35:40 +0100 Message-ID: <1441899340.24450.391.camel@citrix.com> References: <1441896651-24735-1-git-send-email-wei.liu2@citrix.com> <1441896651-24735-4-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Za3t2-0007AG-Mk for xen-devel@lists.xenproject.org; Thu, 10 Sep 2015 15:35:44 +0000 In-Reply-To: <1441896651-24735-4-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu , Xen-devel Cc: Ian Jackson List-Id: xen-devel@lists.xenproject.org On Thu, 2015-09-10 at 15:50 +0100, Wei Liu wrote: > When user specifies vnuma = [], we need to skip the whole parser > function, otherwise the parser sets b_info->max_memkb to garbage value. Arguably the bug here is in the code which does so without reference to num_vnuma (the majority of this function does the right thing if num_vnuma == 0). However we may as well short circuit the whole thing regardless of this bug so: > Signed-off-by: Wei Liu Acked-by: Ian Campbell > --- > tools/libxl/xl_cmdimpl.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index ebbb9a5..7dbf37f 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -1093,6 +1093,9 @@ static void parse_vnuma_config(const XLU_Config > *config, > if (xlu_cfg_get_list(config, "vnuma", &vnuma, &num_vnuma, 1)) > return; > > + if (!num_vnuma) > + return; > + > b_info->num_vnuma_nodes = num_vnuma; > b_info->vnuma_nodes = xcalloc(num_vnuma, sizeof(libxl_vnode_info)); > vcpu_parsed = xcalloc(num_vnuma, sizeof(libxl_bitmap));