mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-25 15:02:13 +00:00
hv: fixup: a minor refine about tpm2_fixup
Check the return value of get_mod_by_tag before use it. Tracked-On: #6380 Signed-off-by: Fei Li <fei1.li@intel.com>
This commit is contained in:
parent
e5aa63b08e
commit
7dd877f8eb
@ -39,7 +39,7 @@ static void tpm2_fixup(uint16_t vm_id)
|
||||
struct abi_module *mod;
|
||||
|
||||
mod = get_mod_by_tag(abi, config->acpi_config.acpi_mod_tag);
|
||||
|
||||
if (mod != NULL) {
|
||||
tpm2 = get_acpi_mod_entry(ACPI_SIG_TPM2, mod->start);
|
||||
native = get_acpi_tbl(ACPI_SIG_TPM2);
|
||||
|
||||
@ -52,7 +52,8 @@ static void tpm2_fixup(uint16_t vm_id)
|
||||
if (native->header.length ==
|
||||
sizeof(struct acpi_table_tpm2)) {
|
||||
need_fix |= tpm2->header.length == 0x34U;
|
||||
need_fix |= strncmp((char *)tpm2->start_method_spec_para, (char *)native->start_method_spec_para,
|
||||
need_fix |= strncmp((char *)tpm2->start_method_spec_para,
|
||||
(char *)native->start_method_spec_para,
|
||||
sizeof(tpm2->start_method_spec_para)) != 0;
|
||||
need_fix |= tpm2->laml != native->laml;
|
||||
need_fix |= tpm2->lasa != native->lasa;
|
||||
@ -63,8 +64,10 @@ static void tpm2_fixup(uint16_t vm_id)
|
||||
tpm2->start_method = native->start_method;
|
||||
tpm2->header.length = native->header.length;
|
||||
tpm2->header.revision = native->header.revision;
|
||||
memcpy_s(&native->start_method_spec_para, sizeof(native->start_method_spec_para),
|
||||
&tpm2->start_method_spec_para, sizeof(native->start_method_spec_para));
|
||||
memcpy_s(&tpm2->start_method_spec_para,
|
||||
sizeof(native->start_method_spec_para),
|
||||
&native->start_method_spec_para,
|
||||
sizeof(native->start_method_spec_para));
|
||||
tpm2->laml = native->laml;
|
||||
tpm2->lasa = config->mmiodevs[0].mmiores[1].base_gpa;
|
||||
|
||||
@ -80,6 +83,7 @@ static void tpm2_fixup(uint16_t vm_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void acrn_vm_fixup(uint16_t vm_id)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user