qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PULL 36/45] i386/sev: Invoke launch_updata_data() for SEV class


From: Peter Maydell
Subject: Re: [PULL 36/45] i386/sev: Invoke launch_updata_data() for SEV class
Date: Fri, 7 Jun 2024 15:18:02 +0100

On Tue, 4 Jun 2024 at 07:49, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Add launch_update_data() in SevCommonStateClass and
> invoke as sev_launch_update_data() for SEV object.
>
> Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
> Message-ID: <20240530111643.1091816-26-pankaj.gupta@amd.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Hi; Coverity points out an issue in this code (CID 1546886):

>  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);

SEV_COMMON_GET_CLASS() dereferences the pointer it is passed,
so it isn't valid to pass it a NULL pointer...

>
>      if (!sev_common) {
>          return 0;

...but we don't do the "return failure if passed NULL" until after
we've dereferenced sev_common.

The get-the-class-pointer operation should be done after this
check, I think.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]