From: Pankaj Gupta <pankaj.gupta@amd.com>
To: <qemu-devel@nongnu.org>
Cc: <brijesh.singh@amd.com>, <dovmurik@linux.ibm.com>,
<armbru@redhat.com>, <michael.roth@amd.com>,
<pbonzini@redhat.com>, <thomas.lendacky@amd.com>,
<peter.maydell@linaro.org>, <pankaj.gupta@amd.com>
Subject: [PATCH 1/3] i386/sev: fix unreachable code coverity issue
Date: Fri, 7 Jun 2024 13:36:09 -0500 [thread overview]
Message-ID: <20240607183611.1111100-2-pankaj.gupta@amd.com> (raw)
In-Reply-To: <20240607183611.1111100-1-pankaj.gupta@amd.com>
Set 'finish->id_block_en' when block_size read.
coverity #1546887
fixes: 7b34df4426 ("i386/sev: Introduce 'sev-snp-guest' object")
Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
---
target/i386/sev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 004c667ac1..7c9df621de 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -2165,6 +2165,7 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp)
struct kvm_sev_snp_launch_finish *finish = &sev_snp_guest->kvm_finish_conf;
gsize len;
+ finish->id_block_en = 0;
g_free(sev_snp_guest->id_block);
g_free((guchar *)finish->id_block_uaddr);
@@ -2184,7 +2185,7 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp)
return;
}
- finish->id_block_en = (len) ? 1 : 0;
+ finish->id_block_en = 1;
}
static char *
--
2.34.1
next prev parent reply other threads:[~2024-06-07 23:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 18:36 [PATCH 0/3] snp: fix coverity reported issues Pankaj Gupta
2024-06-07 18:36 ` Pankaj Gupta [this message]
2024-06-10 5:35 ` [PATCH 1/3] i386/sev: fix unreachable code coverity issue Markus Armbruster
2024-06-07 18:36 ` [PATCH 2/3] i386/sev: Move SEV_COMMON null check before dereferencing Pankaj Gupta
2024-06-07 18:36 ` [PATCH 3/3] i386/sev: Return when sev_common is null Pankaj Gupta
2024-06-11 12:26 ` [PATCH 0/3] snp: fix coverity reported issues Paolo Bonzini
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=20240607183611.1111100-2-pankaj.gupta@amd.com \
--to=pankaj.gupta@amd.com \
--cc=armbru@redhat.com \
--cc=brijesh.singh@amd.com \
--cc=dovmurik@linux.ibm.com \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thomas.lendacky@amd.com \
/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).