public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] coverity: fix coverity issues related to confidential guest reset
@ 2026-03-11  3:46 Ani Sinha
  2026-03-11  7:46 ` Zhao Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Ani Sinha @ 2026-03-11  3:46 UTC (permalink / raw)
  To: Paolo Bonzini, Marcelo Tosatti, Zhao Liu
  Cc: Ani Sinha, Peter Maydell, qemu-devel, kvm

Fix issues reported by Peter.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
 system/runstate.c | 5 ++++-
 target/i386/sev.c | 4 ----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/system/runstate.c b/system/runstate.c
index eca722b43c..ca6730d111 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -512,9 +512,12 @@ void qemu_system_reset(ShutdownCause reason)
     ResetType type;
     AccelClass *ac = ACCEL_GET_CLASS(current_accel());
     bool guest_state_rebuilt = false;
+    bool force_vmfd_change = false;
     int ret;
 
     mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;
+    force_vmfd_change = current_machine ?
+        current_machine->new_accel_vmfd_on_reset : false;
 
     cpu_synchronize_all_states();
 
@@ -528,7 +531,7 @@ void qemu_system_reset(ShutdownCause reason)
 
     if ((reason == SHUTDOWN_CAUSE_GUEST_RESET ||
          reason == SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET) &&
-        (current_machine->new_accel_vmfd_on_reset || !cpus_are_resettable())) {
+        (force_vmfd_change || !cpus_are_resettable())) {
         if (ac->rebuild_guest) {
             ret = ac->rebuild_guest(current_machine);
             if (ret < 0) {
diff --git a/target/i386/sev.c b/target/i386/sev.c
index cddffe0da8..9dde972c11 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -2011,10 +2011,6 @@ static void sev_handle_reset(Object *obj, ResetType type)
     SevCommonState *sev_common = SEV_COMMON(MACHINE(qdev_get_machine())->cgs);
     SevCommonStateClass *klass = SEV_COMMON_GET_CLASS(sev_common);
 
-    if (!sev_common) {
-        return;
-    }
-
     if (!runstate_is_running()) {
         return;
     }
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] coverity: fix coverity issues related to confidential guest reset
  2026-03-11  3:46 [PATCH] coverity: fix coverity issues related to confidential guest reset Ani Sinha
@ 2026-03-11  7:46 ` Zhao Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Zhao Liu @ 2026-03-11  7:46 UTC (permalink / raw)
  To: Ani Sinha; +Cc: Paolo Bonzini, Marcelo Tosatti, Peter Maydell, qemu-devel, kvm

On Wed, Mar 11, 2026 at 09:16:53AM +0530, Ani Sinha wrote:
> Date: Wed, 11 Mar 2026 09:16:53 +0530
> From: Ani Sinha <anisinha@redhat.com>
> Subject: [PATCH] coverity: fix coverity issues related to confidential
>  guest reset
> X-Mailer: git-send-email 2.42.0
> 
> Fix issues reported by Peter.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Ani Sinha <anisinha@redhat.com>
> ---
>  system/runstate.c | 5 ++++-
>  target/i386/sev.c | 4 ----
>  2 files changed, 4 insertions(+), 5 deletions(-)

It's better to add Fixes tag or links.

Otherwise,

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-11  7:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-11  3:46 [PATCH] coverity: fix coverity issues related to confidential guest reset Ani Sinha
2026-03-11  7:46 ` Zhao Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox