From: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
To: andrew.cooper3@citrix.com, jbeulich@suse.com, keir@xen.org
Cc: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>,
coverity@xenproject.org, xen-devel@lists.xen.org
Subject: [PATCH 1/2 V2] x86, amd_ucode: Fix coverity issues found in cpu_request_microcode()
Date: Wed, 30 Jul 2014 17:29:32 -0500 [thread overview]
Message-ID: <1406759372-15314-1-git-send-email-aravind.gopalakrishnan@amd.com> (raw)
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@citrix.com>
Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Reviewed-by: Andrew Cooper<andrew.cooper3@citrix.com>
---
xen/arch/x86/microcode_amd.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/xen/arch/x86/microcode_amd.c b/xen/arch/x86/microcode_amd.c
index 14728a2..d0a544c 100644
--- a/xen/arch/x86/microcode_amd.c
+++ b/xen/arch/x86/microcode_amd.c
@@ -384,9 +384,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;
@@ -398,7 +402,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);
@@ -407,15 +411,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;
}
--
2.0.3
reply other threads:[~2014-07-30 22:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1406759372-15314-1-git-send-email-aravind.gopalakrishnan@amd.com \
--to=aravind.gopalakrishnan@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=coverity@xenproject.org \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).