From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Daley Subject: [PATCH 01/29] libxc: check for xc_domain_get_guest_width failure and pass it down Date: Wed, 30 Oct 2013 20:51:37 +1300 Message-ID: <1383119525-26033-2-git-send-email-mattjd@gmail.com> References: <1383119525-26033-1-git-send-email-mattjd@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383119525-26033-1-git-send-email-mattjd@gmail.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: xen-devel@lists.xen.org Cc: Matthew Daley , Ian Jackson , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org ...in xc_cpuid_pv_policy. Coverity-ID: 1093050 Signed-off-by: Matthew Daley --- 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