hw/uefi: fix size negotiation

Payload size is the variable request size, not the total buffer size.
Take that into account and subtract header sizes.

Fixes: db1ecfb473 ("hw/uefi: add var-service-vars.c")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-ID: <20260114104745.3465860-1-kraxel@redhat.com>
(cherry picked from commit 46dee71a945d50639586ca3365be29aa9f368bfd)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Gerd Hoffmann 2026-01-14 11:47:45 +01:00 committed by Michael Tokarev
parent 89f7d4fb13
commit 8bf4744182

View file

@ -592,7 +592,7 @@ uefi_vars_mm_get_payload_size(uefi_vars_state *uv, mm_header *mhdr,
return uefi_vars_mm_error(mhdr, mvar, EFI_BAD_BUFFER_SIZE);
}
ps->payload_size = uv->buf_size;
ps->payload_size = uv->buf_size - sizeof(*mhdr) - sizeof(*mvar);
mvar->status = EFI_SUCCESS;
return length;
}