On Fri, 2025-01-24 at 08:20 -0500, Xiaoyao Li wrote:
> +static void tdx_finalize_vm(Notifier *notifier, void *unused)
> +{
> +    TdxFirmware *tdvf = &tdx_guest->tdvf;
> +    TdxFirmwareEntry *entry;
> +
> +    for_each_tdx_fw_entry(tdvf, entry) {
> +        switch (entry->type) {
> +        case TDVF_SECTION_TYPE_BFV:
> +        case TDVF_SECTION_TYPE_CFV:
> +            entry->mem_ptr = tdvf->mem_ptr + entry->data_offset;
> +            break;
> +        case TDVF_SECTION_TYPE_TD_HOB:
> +        case TDVF_SECTION_TYPE_TEMP_MEM:
> +            entry->mem_ptr = qemu_ram_mmap(-1, entry->size,
> +                                          
> qemu_real_host_page_size(), 0, 0);
> +            break;

Should check for MAP_FAILED return value.

> +        default:
> +            error_report("Unsupported TDVF section %d", entry-
> >type);
> +            exit(1);

Section entry types have already been checked against valid types in
tdvf_parse_and_check_section_entry(), no need to check them again here.

Reply via email to