From: Wei Liu Subject: Re: [PATCH for-4.6] libxl: fix libxl__build_hvm error code return path Date: Tue, 11 Aug 2015 09:57:06 +0100 Message-ID: <20150811085706.GA7460@zion.uk.xensource.com> References: <1438963705-8407-1-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZP5Ms-0004mO-Rj for xen-devel@lists.xenproject.org; Tue, 11 Aug 2015 08:57:10 +0000 Content-Disposition: inline In-Reply-To: <1438963705-8407-1-git-send-email-roger.pau@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: Roger Pau Monne Cc: xen-devel@lists.xenproject.org, Wei Liu , Ian Jackson , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Fri, Aug 07, 2015 at 06:08:25PM +0200, Roger Pau Monne wrote: > This is a simple fix to make sure libxl__build_hvm returns an error code = in > case of failure. > = > Signed-off-by: Roger Pau Monn=E9 > Cc: Ian Jackson > Cc: Stefano Stabellini > Cc: Ian Campbell > Cc: Wei Liu Acked-by: Wei Liu Though I would like to make commit message clearer. 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 error path to fix this. A more comprehensive fix would be changing all ret to rc, which should be done when next development window opens. > --- > I would rather prefer to have it fixed in a proper way like it's done in = my > "libxl: fix libxl__build_hvm error handling" as part of the HVMlite serie= s, > but I understand that given the current status of the tree and the > willingness to backport this to stable branches the other approach is goi= ng > to be much harder. > --- > tools/libxl/libxl_dom.c | 1 + > 1 file changed, 1 insertion(+) > = > diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c > index e1f11a3..668ce11 100644 > --- a/tools/libxl/libxl_dom.c > +++ b/tools/libxl/libxl_dom.c > @@ -1019,6 +1019,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid, > = > return 0; > out: > + rc =3D ERROR_FAIL; > return rc; > } > = > -- = > 1.9.5 (Apple Git-50.3)