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

[Xen-changelog] [xen master] x86, amd_ucode: fix coverity issues found in cpu_request_microcode()



commit 6784dd6fdc43914e9bf5b080e12c7877d000dffa
Author:     Aravind Gopalakrishnan <aravind.gopalakrishnan@xxxxxxx>
AuthorDate: Fri Aug 1 16:47:48 2014 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Aug 1 16:47:48 2014 +0200

    x86, amd_ucode: fix coverity issues found in cpu_request_microcode()
    
    This patch fixes issues reported by coverity.
     - CID 1229147: dead code
     - CID 1229148: possible resource leak of mc_amd due to goto out statements.
    
    Coverity-IDs: 1229147, 1229148
    Reported-by: Andrew Cooper<andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@xxxxxxx>
    Reviewed-by: Andrew Cooper<andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/microcode_amd.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/microcode_amd.c b/xen/arch/x86/microcode_amd.c
index 8f16826..1e5503d 100644
--- a/xen/arch/x86/microcode_amd.c
+++ b/xen/arch/x86/microcode_amd.c
@@ -379,9 +379,13 @@ static int cpu_request_microcode(int cpu, const void *buf, 
size_t bufsize)
     while ( offset < bufsize )
     {
         error = install_equiv_cpu_table(mc_amd, buf, &offset);
+        if ( error )
+        {
+            printk(KERN_ERR "microcode: installing equivalent cpu table 
failed\n");
+            break;
+        }
 
-        if ( !error &&
-             find_equiv_cpu_id(mc_amd->equiv_cpu_table, current_cpu_id,
+        if ( find_equiv_cpu_id(mc_amd->equiv_cpu_table, current_cpu_id,
                                &equiv_cpu_id) )
                 break;
 
@@ -393,7 +397,7 @@ static int cpu_request_microcode(int cpu, const void *buf, 
size_t bufsize)
         {
             printk(KERN_ERR "microcode: Microcode buffer overrun\n");
             error = -EINVAL;
-            goto out;
+            break;
         }
 
         error = container_fast_forward(buf, bufsize - offset, &offset);
@@ -402,15 +406,13 @@ static int cpu_request_microcode(int cpu, const void 
*buf, size_t bufsize)
             printk(KERN_ERR "microcode: CPU%d incorrect or corrupt container 
file\n"
                    "microcode: Failed to update patch level. "
                    "Current lvl:%#x\n", cpu, uci->cpu_sig.rev);
-            goto out;
+            break;
         }
     }
 
     if ( error )
     {
         xfree(mc_amd);
-        printk(KERN_ERR "microcode: installing equivalent cpu table failed\n");
-        error = -EINVAL;
         goto out;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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