On Tue, 4 Jun 2024 at 07:49, Paolo Bonzini <[email protected]> wrote:
>
> Add launch_update_data() in SevCommonStateClass and
> invoke as sev_launch_update_data() for SEV object.
>
> Signed-off-by: Pankaj Gupta <[email protected]>
> Message-ID: <[email protected]>
> Signed-off-by: Paolo Bonzini <[email protected]>
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