All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] snp: fix coverity reported issues
@ 2024-06-07 18:36 Pankaj Gupta
  2024-06-07 18:36 ` [PATCH 1/3] i386/sev: fix unreachable code coverity issue Pankaj Gupta
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Pankaj Gupta @ 2024-06-07 18:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: brijesh.singh, dovmurik, armbru, michael.roth, pbonzini,
	thomas.lendacky, peter.maydell, pankaj.gupta

Pankaj Gupta (3):
  i386/sev: fix unreachable code coverity issue
  i386/sev: Move SEV_COMMON null check before dereferencing
  i386/sev: Return when sev_common is null

 target/i386/sev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

-- 
2.34.1



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

* [PATCH 1/3] i386/sev: fix unreachable code coverity issue
  2024-06-07 18:36 [PATCH 0/3] snp: fix coverity reported issues Pankaj Gupta
@ 2024-06-07 18:36 ` Pankaj Gupta
  2024-06-10  5:35   ` Markus Armbruster
  2024-06-07 18:36 ` [PATCH 2/3] i386/sev: Move SEV_COMMON null check before dereferencing Pankaj Gupta
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Pankaj Gupta @ 2024-06-07 18:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: brijesh.singh, dovmurik, armbru, michael.roth, pbonzini,
	thomas.lendacky, peter.maydell, pankaj.gupta

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



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

* [PATCH 2/3] i386/sev: Move SEV_COMMON null check before dereferencing
  2024-06-07 18:36 [PATCH 0/3] snp: fix coverity reported issues Pankaj Gupta
  2024-06-07 18:36 ` [PATCH 1/3] i386/sev: fix unreachable code coverity issue Pankaj Gupta
@ 2024-06-07 18:36 ` 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
  3 siblings, 0 replies; 6+ messages in thread
From: Pankaj Gupta @ 2024-06-07 18:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: brijesh.singh, dovmurik, armbru, michael.roth, pbonzini,
	thomas.lendacky, peter.maydell, pankaj.gupta

coverity #1546886

fixes: 9861405a8f ("i386/sev: Invoke launch_updata_data() for SEV class")
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 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.34.1



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

* [PATCH 3/3] i386/sev: Return when sev_common is null
  2024-06-07 18:36 [PATCH 0/3] snp: fix coverity reported issues Pankaj Gupta
  2024-06-07 18:36 ` [PATCH 1/3] i386/sev: fix unreachable code coverity issue Pankaj Gupta
  2024-06-07 18:36 ` [PATCH 2/3] i386/sev: Move SEV_COMMON null check before dereferencing Pankaj Gupta
@ 2024-06-07 18:36 ` Pankaj Gupta
  2024-06-11 12:26 ` [PATCH 0/3] snp: fix coverity reported issues Paolo Bonzini
  3 siblings, 0 replies; 6+ messages in thread
From: Pankaj Gupta @ 2024-06-07 18:36 UTC (permalink / raw)
  To: qemu-devel
  Cc: brijesh.singh, dovmurik, armbru, michael.roth, pbonzini,
	thomas.lendacky, peter.maydell, pankaj.gupta

coverity #1546885

fixes: 16dcf200dc ("i386/sev: Introduce "sev-common" type to encapsulate common SEV state")
Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
---
 target/i386/sev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/i386/sev.c b/target/i386/sev.c
index f18432f58e..c40562dce3 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -587,6 +587,7 @@ static SevCapability *sev_get_capabilities(Error **errp)
     sev_common = SEV_COMMON(MACHINE(qdev_get_machine())->cgs);
     if (!sev_common) {
         error_setg(errp, "SEV is not configured");
+        return NULL;
     }
 
     sev_device = object_property_get_str(OBJECT(sev_common), "sev-device",
-- 
2.34.1



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

* Re: [PATCH 1/3] i386/sev: fix unreachable code coverity issue
  2024-06-07 18:36 ` [PATCH 1/3] i386/sev: fix unreachable code coverity issue Pankaj Gupta
@ 2024-06-10  5:35   ` Markus Armbruster
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2024-06-10  5:35 UTC (permalink / raw)
  To: Pankaj Gupta
  Cc: qemu-devel, brijesh.singh, dovmurik, michael.roth, pbonzini,
	thomas.lendacky, peter.maydell

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>



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

* Re: [PATCH 0/3] snp: fix coverity reported issues
  2024-06-07 18:36 [PATCH 0/3] snp: fix coverity reported issues Pankaj Gupta
                   ` (2 preceding siblings ...)
  2024-06-07 18:36 ` [PATCH 3/3] i386/sev: Return when sev_common is null Pankaj Gupta
@ 2024-06-11 12:26 ` Paolo Bonzini
  3 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2024-06-11 12:26 UTC (permalink / raw)
  To: Pankaj Gupta
  Cc: qemu-devel, brijesh.singh, dovmurik, armbru, michael.roth,
	pbonzini, thomas.lendacky, peter.maydell

Queued, thanks.

Paolo



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

end of thread, other threads:[~2024-06-11 12:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-07 18:36 [PATCH 0/3] snp: fix coverity reported issues Pankaj Gupta
2024-06-07 18:36 ` [PATCH 1/3] i386/sev: fix unreachable code coverity issue Pankaj Gupta
2024-06-10  5:35   ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.