[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 01/29] libxc: check for xc_domain_get_guest_width failure and pass it down



...in xc_cpuid_pv_policy.

Coverity-ID: 1093050
Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>
---
 tools/libxc/xc_cpuid_x86.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index bbbf9b8..865d02a 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -431,7 +431,7 @@ static void xc_cpuid_hvm_policy(
 
 }
 
-static void xc_cpuid_pv_policy(
+static int xc_cpuid_pv_policy(
     xc_interface *xch, domid_t domid,
     const unsigned int *input, unsigned int *regs)
 {
@@ -443,7 +443,8 @@ static void xc_cpuid_pv_policy(
 
     xc_cpuid_brand_get(brand);
 
-    xc_domain_get_guest_width(xch, domid, &guest_width);
+    if ( xc_domain_get_guest_width(xch, domid, &guest_width) != 0 )
+        return 1;
     guest_64bit = (guest_width == 8);
 
     /* Detecting Xen's atitude towards XSAVE */
@@ -547,6 +548,8 @@ static void xc_cpuid_pv_policy(
         regs[0] = regs[1] = regs[2] = regs[3] = 0;
         break;
     }
+
+    return 0;
 }
 
 static int xc_cpuid_policy(
@@ -561,7 +564,8 @@ static int xc_cpuid_policy(
     if ( info.hvm )
         xc_cpuid_hvm_policy(xch, domid, input, regs);
     else
-        xc_cpuid_pv_policy(xch, domid, input, regs);
+        if ( xc_cpuid_pv_policy(xch, domid, input, regs) != 0 )
+            return -EINVAL;
 
     return 0;
 }
@@ -632,7 +636,9 @@ int xc_cpuid_apply_policy(xc_interface *xch, domid_t domid)
     for ( ; ; )
     {
         cpuid(input, regs);
-        xc_cpuid_policy(xch, domid, input, regs);
+        rc = xc_cpuid_policy(xch, domid, input, regs);
+        if ( rc )
+            return rc;
 
         if ( regs[0] || regs[1] || regs[2] || regs[3] )
         {
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.