All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/i386/mshv: zero-init msr hvcall args
@ 2026-07-01 13:42 Magnus Kulke
  2026-07-01 14:11 ` Philippe Mathieu-Daudé
  2026-07-02 13:50 ` Doru Blânzeanu
  0 siblings, 2 replies; 3+ messages in thread
From: Magnus Kulke @ 2026-07-01 13:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Doru Blânzeanu, Magnus Kulke, Peter Maydell,
	Doru Blânzeanu, Wei Liu, Wei Liu, Magnus Kulke

In the current code we leave the argument arrays for the get/set hvcall
unitialized, setting only individual fields. some fields will be
populated during the hvcall, but in any case the arg arrays will contain
unitialized data (e.g. in reserved fields), to which static analysis
objects to.

Fixes: c38eb12c85
Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
---
 target/i386/mshv/msr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/mshv/msr.c b/target/i386/mshv/msr.c
index 8c220a9942..a35415ed9d 100644
--- a/target/i386/mshv/msr.c
+++ b/target/i386/mshv/msr.c
@@ -326,7 +326,7 @@ int mshv_get_msrs(CPUState *cpu)
 {
     int ret = 0;
     size_t n_assocs = MSHV_MSR_TOTAL_COUNT;
-    struct hv_register_assoc assocs[MSHV_MSR_TOTAL_COUNT];
+    struct hv_register_assoc assocs[MSHV_MSR_TOTAL_COUNT] = { 0 };
     size_t i, j;
     uint32_t name;
 
@@ -386,7 +386,7 @@ static void load_from_env(const CPUState *cpu, struct hv_register_assoc *assocs,
 int mshv_set_msrs(const CPUState *cpu)
 {
     size_t n_assocs = MSHV_MSR_TOTAL_COUNT;
-    struct hv_register_assoc assocs[MSHV_MSR_TOTAL_COUNT];
+    struct hv_register_assoc assocs[MSHV_MSR_TOTAL_COUNT] = { 0 };
     int ret;
     size_t i, j;
 
-- 
2.34.1



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

end of thread, other threads:[~2026-07-02 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 13:42 [PATCH] target/i386/mshv: zero-init msr hvcall args Magnus Kulke
2026-07-01 14:11 ` Philippe Mathieu-Daudé
2026-07-02 13:50 ` Doru Blânzeanu

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.