On Thu, 9 Oct 2025 at 08:53, Paolo Bonzini <[email protected]> wrote:
>
> From: Magnus Kulke <[email protected]>
>
> Create MSHV vCPUs using MSHV_CREATE_VP and initialize their state.
> Register the MSHV CPU execution loop loop with the QEMU accelerator
> framework to enable guest code execution.
>
> The target/i386 functionality is still mostly stubbed out and will be
> populated in a later commit in this series.
>
> Signed-off-by: Magnus Kulke <[email protected]>
> Link:
> https://lore.kernel.org/r/[email protected]
> [Fix g_free/g_clear_pointer confusion; rename qemu_wait_io_event;
> mshv.h/mshv_int.h split. - Paolo]
> Signed-off-by: Paolo Bonzini <[email protected]>
> ---
Hi; Coverity points out a problem with this code (CID 1641400):
> static void mshv_start_vcpu_thread(CPUState *cpu)
> {
> - error_report("unimplemented");
> - abort();
> + char thread_name[VCPU_THREAD_NAME_SIZE];
Here we create an array, which we don't initialize...
> +
> + cpu->thread = g_malloc0(sizeof(QemuThread));
> + cpu->halt_cond = g_malloc0(sizeof(QemuCond));
> +
> + qemu_cond_init(cpu->halt_cond);
> +
> + trace_mshv_start_vcpu_thread(thread_name, cpu->cpu_index);
...and here we tell the trace event to print the uninitialized
array as a string, which will print garbage...
> + qemu_thread_create(cpu->thread, thread_name, mshv_vcpu_thread, cpu,
> + QEMU_THREAD_JOINABLE);
...and we pass the uninitialized array to qemu_thread_create() too.
Something needs to init the array here :-)
> +}
thanks
-- PMM