forked from rpms/qemu-kvm
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.7 KiB
48 lines
1.7 KiB
1 month ago
|
From fa6076291eb45255bc2fe523399d7d0647fc5570 Mon Sep 17 00:00:00 2001
|
||
|
From: Pankaj Gupta <pankaj.gupta@amd.com>
|
||
|
Date: Fri, 7 Jun 2024 13:36:10 -0500
|
||
|
Subject: [PATCH 085/100] i386/sev: Move SEV_COMMON null check before
|
||
|
dereferencing
|
||
|
|
||
|
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
||
|
RH-MergeRequest: 245: SEV-SNP support
|
||
|
RH-Jira: RHEL-39544
|
||
|
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
||
|
RH-Acked-by: Bandan Das <bdas@redhat.com>
|
||
|
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||
|
RH-Commit: [85/91] e8d2bfd077766a5e7777b9337d0e77146f883224 (bonzini/rhel-qemu-kvm)
|
||
|
|
||
|
Fixes Coverity CID 1546886.
|
||
|
|
||
|
Fixes: 9861405a8f ("i386/sev: Invoke launch_updata_data() for SEV class")
|
||
|
Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
|
||
|
Message-ID: <20240607183611.1111100-3-pankaj.gupta@amd.com>
|
||
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||
|
(cherry picked from commit 48779faef3c8e2fe70bd8285bffa731bd76dc844)
|
||
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.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 7c9df621de..f18432f58e 100644
|
||
|
--- a/target/i386/sev.c
|
||
|
+++ b/target/i386/sev.c
|
||
|
@@ -1529,11 +1529,12 @@ int
|
||
|
sev_encrypt_flash(hwaddr gpa, uint8_t *ptr, uint64_t len, Error **errp)
|
||
|
{
|
||
|
SevCommonState *sev_common = SEV_COMMON(MACHINE(qdev_get_machine())->cgs);
|
||
|
- SevCommonStateClass *klass = SEV_COMMON_GET_CLASS(sev_common);
|
||
|
+ SevCommonStateClass *klass;
|
||
|
|
||
|
if (!sev_common) {
|
||
|
return 0;
|
||
|
}
|
||
|
+ klass = SEV_COMMON_GET_CLASS(sev_common);
|
||
|
|
||
|
/* if SEV is in update state then encrypt the data else do nothing */
|
||
|
if (sev_check_state(sev_common, SEV_STATE_LAUNCH_UPDATE)) {
|
||
|
--
|
||
|
2.39.3
|
||
|
|