From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 5/7] libxc: Removing dead code from xc_dom_allocate() Date: Fri, 3 Jul 2015 16:31:12 +0100 Message-ID: <1435937472.9447.160.camel@citrix.com> References: <1435772232-39085-1-git-send-email-Jennifer.Herbert@citrix.com> <1435772232-39085-6-git-send-email-Jennifer.Herbert@citrix.com> <21910.43309.449892.131597@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21910.43309.449892.131597@mariner.uk.xensource.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: Ian Jackson Cc: wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com, Jennifer Herbert , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Fri, 2015-07-03 at 16:24 +0100, Ian Jackson wrote: > Jennifer Herbert writes ("[Xen-devel] [PATCH 5/7] libxc: Removing dead code from xc_dom_allocate()"): > > The only place that jumps to 'err:' does so because !dom, which is > > rechecked in 'err:'. This patch simplifies, giving the same result. > > I'm not particularly convinced by this change, but maybe Ian Campbell > disagrees. > > I presume that your Coverity instance is complaining about the fact > that the if (dom) clause's test is always false. This is true with > the current code, but if this function were to gain any other code it > might stop being true and the first thing to do to get a good error > handling pattern would be to revert this patch. I briefly thought something like this but decided it was under my threshold for worrying about. > However: If we're doing teh `initialise everything; single goto for > error paths; dispose of everything' error handling pattern, dom ought > to be initialised to NULL. > > Ian C, what do you think ? > > Thanks, > Ian.