[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/7] libxc: fix uninitialized variable in xc_cpuid_pv_policy()
If xc_domain_get_guest_width were to fail, guest_width is not set, and hence guest_64bit becomes undefined. Fix is to initialise to 0, and report error if call fails. Signed-off-by: Jennifer Herbert <jennifer.herbert@xxxxxxxxxx> --- tools/libxc/xc_cpuid_x86.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index c97f91a..847b701 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -437,14 +437,16 @@ static void xc_cpuid_pv_policy( { DECLARE_DOMCTL; unsigned int guest_width; - int guest_64bit; + int guest_64bit = 0; char brand[13]; uint64_t xfeature_mask; xc_cpuid_brand_get(brand); - xc_domain_get_guest_width(xch, domid, &guest_width); - guest_64bit = (guest_width == 8); + if (xc_domain_get_guest_width(xch, domid, &guest_width) == 0) + guest_64bit = (guest_width == 8); + else + ERROR("Could not read guest word width."); /* Detecting Xen's atitude towards XSAVE */ memset(&domctl, 0, sizeof(domctl)); -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |