|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/7] libxc: Fix uninitialized valiables in xc_cpuid_hvm_policy()
If xc_hvm_param_get fails, is_pae and/or is_nestedhvm are left undefined.
This patch Indicates error and defaults to false.
Signed-off-by: Jennifer Herbert <jennifer.herbert@xxxxxxxxxx>
---
tools/libxc/xc_cpuid_x86.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 847b701..cc6f18a 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -268,11 +268,16 @@ static void xc_cpuid_hvm_policy(
{
DECLARE_DOMCTL;
char brand[13];
- uint64_t val;
- int is_pae, is_nestedhvm;
+ uint64_t val = 0;
+ int is_pae;
+ int is_nestedhvm = 0;
uint64_t xfeature_mask;
+ int rc;
+
+ rc = xc_hvm_param_get(xch, domid, HVM_PARAM_PAE_ENABLED, &val);
+ if ( rc < 0 )
+ ERROR("xc_hvm_param_get failed to get PAE_ENABLED with rc %d\n", rc);
- xc_hvm_param_get(xch, domid, HVM_PARAM_PAE_ENABLED, &val);
is_pae = !!val;
/* Detecting Xen's atitude towards XSAVE */
@@ -282,8 +287,11 @@ static void xc_cpuid_hvm_policy(
do_domctl(xch, &domctl);
xfeature_mask = domctl.u.vcpuextstate.xfeature_mask;
- xc_hvm_param_get(xch, domid, HVM_PARAM_NESTEDHVM, &val);
- is_nestedhvm = !!val;
+ rc = xc_hvm_param_get(xch, domid, HVM_PARAM_NESTEDHVM, &val);
+ if ( rc >= 0 )
+ is_nestedhvm = !!val;
+ else
+ ERROR("xc_hvm_param_get failed to get NESTEDHVM with rc %d\n", rc);
switch ( input[0] )
{
--
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 |