From: Ian Jackson Subject: Re: [PATCH for-4.6] libxl: fix libxl__build_hvm error code return path Date: Wed, 12 Aug 2015 16:49:01 +0100 Message-ID: <21963.27373.433211.956730@mariner.uk.xensource.com> References: <1439300892-6836-1-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 1ZPYH9-0003wO-U8 for xen-devel@lists.xenproject.org; Wed, 12 Aug 2015 15:49:12 +0000 In-Reply-To: <1439300892-6836-1-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 Cc: xen-devel@lists.xenproject.org, Roger Pau Monne , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Wei Liu writes ("[PATCH for-4.6] libxl: fix libxl__build_hvm error code return path"): > In 25652f23 ("tools/libxl: detect and avoid conflicts with RDM"), new > code was added to use rc to store libxl function call return value, > which complied to libxl coding style. That patch, however, didn't change > other locations where return value was stored in ret. In the end > libxl__build_hvm could return 0 when it failed. > > Explicitly set rc to ERROR_FAIL in all error paths to fix this. ... > ret = libxl__vnuma_build_vmemrange_hvm(gc, domid, info, state, &args); > if (ret) { Why not change all the assignemnts to ret to assignments to rc, and abolish ret ? > LOGEV(ERROR, ret, "hvm build vmemranges failed"); > + rc = ERROR_FAIL; Certainly this is wrong because it smashes all errors into ERROR_FAIL. Ian.