From: Konrad Rzeszutek Wilk Subject: [PATCH 2/3] libxl/remus: Move the assert before the info is used. Date: Mon, 25 Jan 2016 16:06:56 -0500 Message-ID: <1453756017-8747-3-git-send-email-konrad.wilk@oracle.com> References: <1453756017-8747-1-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aNoMA-0000Xd-O4 for xen-devel@lists.xenproject.org; Mon, 25 Jan 2016 21:07:26 +0000 In-Reply-To: <1453756017-8747-1-git-send-email-konrad.wilk@oracle.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: xen-devel@lists.xenproject.org, ian.campbell@citrix.com, wei.liu2@citrix.com, ian.jackson@eu.citrix.com Cc: Yang Hongyang , Wen Congyang , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org The assert(info) is after quite a lot of manipulations on 'info' - which makes the assert pointless because if info was NULL it would have crashed earlier. Move it earlier so that it guards before we try using the 'info' structure. CC: Wen Congyang CC: Yang Hongyang Signed-off-by: Konrad Rzeszutek Wilk --- tools/libxl/libxl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 2bde0f5..60974cc 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -855,6 +855,8 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, goto out; } + assert(info); + libxl_defbool_setdefault(&info->allow_unsafe, false); libxl_defbool_setdefault(&info->blackhole, false); libxl_defbool_setdefault(&info->compression, true); @@ -883,8 +885,6 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, dss->debug = 0; dss->remus = info; - assert(info); - /* Point of no return */ libxl__remus_setup(egc, dss); return AO_INPROGRESS; -- 2.4.3