[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] tools/libxc: Initialise parameters in map_p2m_list() for error paths
On Thu, 2016-01-07 at 15:24 +0000, Andrew Cooper wrote: > On 07/01/16 15: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. > > So it is - I missed that one when looking the options. > > > > > 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. > > I don't think asserting details like this is a scalable options.ÂÂAlso, > it doesn't help the compilation error if someone ends up disabling > assert() by playing with NDEBUG. It could be an error return instead (which is what I meant to suggest without the parenthetical). > All that is needed is an adjustment to the commit message IMO: I can live with this. > > ---8<--- > tools/libxc: Initialise parameters in map_p2m_list() for error paths > > 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. > > Indeed, the malloc() failure path would end using 'ptes' while > uninitialised.ÂÂInitialise the parameters to safe defaults. > > Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |