From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: Re: [PATCH] tools/libxc: Initialise parameters in map_p2m_list() for error paths Date: Thu, 7 Jan 2016 16:19:28 +0100 Message-ID: <568E8200.2000801@suse.com> References: <1452178530-4450-1-git-send-email-andrew.cooper3@citrix.com> <1452179172.21055.232.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1452179172.21055.232.camel@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: Ian Campbell , Andrew Cooper , Xen-devel Cc: Wei Liu , Ian Jackson List-Id: xen-devel@lists.xenproject.org On 07/01/16 16:06, Ian Campbell wrote: > On Thu, 2016-01-07 at 14:55 +0000, Andrew Cooper wrote: >> c/s 7bf7458 "libxc: support of linear p2m list for migration of >> pv-domains" breaks compilation on CentOS 7 because of 'ptes' being >> possibly uninitialised after the 'err:' label. >> >> The migration will fail early for conditions which would cause the for() >> loop not to run, but the compiler doesn't know this. > > Isn't the issue the malloc goto err path before the loop? Looks like that > should have the error behaviour from the earlier half of the function > rather than the latter. Yes to both. OTOH with Andrew's patch the code behaves correctly. > There might also be a path if ctx->x86_pv.levels == 0, in which case the > loop will never run, that's the sort of thing which could be checked (or > even perhaps asserted) on entry to the function. As there is no function vector involved between setting levels and consuming it I doubt this makes really sense. Juergen