diff mbox series

[1/3] i386/sev: fix unreachable code coverity issue

Message ID 20240607183611.1111100-2-pankaj.gupta@amd.com (mailing list archive)
State New, archived
Headers show
Series snp: fix coverity reported issues | expand

Commit Message

Gupta, Pankaj June 7, 2024, 6:36 p.m. UTC
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(-)

Comments

Markus Armbruster June 10, 2024, 5:35 a.m. UTC | #1
Pankaj Gupta <pankaj.gupta@amd.com> writes:

> Set 'finish->id_block_en' when block_size read.
>
> coverity #1546887
>
> fixes: 7b34df4426 ("i386/sev: Introduce 'sev-snp-guest' object")

Please make that

  Fixes: Coverity CID 1546887
  Fixes: 7b34df4426 ("i386/sev: Introduce 'sev-snp-guest' object")

> Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
diff mbox series

Patch

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 *