On Mon, 2 Mar 2026 at 08:57, Paolo Bonzini <[email protected]> wrote:
>
> From: Ani Sinha <[email protected]>
>
> A new machine specific option 'x-change-vmfd-on-reset' is introduced for
> debugging and testing only (hence the 'x-' prefix). This option when enabled
> will force KVM VM file descriptor to be changed upon guest reset like
> in the case of confidential guests. This can be used to exercise the code
> changes that are specific for confidential guests on non-confidential
> guests as well (except changes that require hardware support for
> confidential guests).
> A new functional test has been added in the next patch that uses this new
> parameter to test the VM file descriptor changes.
>
> Signed-off-by: Ani Sinha <[email protected]>
> Link: https://lore.kernel.org/r/[email protected]
> Signed-off-by: Paolo Bonzini <[email protected]>

Hi; Coverity points out an issue in this commit (CID 1644565):

> --- a/system/runstate.c
> +++ b/system/runstate.c
> @@ -526,9 +526,9 @@ void qemu_system_reset(ShutdownCause reason)
>          type = RESET_TYPE_COLD;
>      }
>
> -    if (!cpus_are_resettable() &&
> -        (reason == SHUTDOWN_CAUSE_GUEST_RESET ||
> -         reason == SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET)) {
> +    if ((reason == SHUTDOWN_CAUSE_GUEST_RESET ||
> +         reason == SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET) &&
> +        (current_machine->new_accel_vmfd_on_reset || 
> !cpus_are_resettable())) {

This change adds a dereference of current_machine, but earlier
in the file we have

    mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;

which assumes that current_machine can be NULL.

Presumably here we should be handling the current_machine == NULL
possibility?

>          if (ac->rebuild_guest) {
>              ret = ac->rebuild_guest(current_machine);
>              if (ret < 0) {
> --
> 2.53.0

thanks
-- PMM

Reply via email to