mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
OvmfPkg/RiscVVirt/PlatformPei: Do not set PcdTpmBaseAddress to garbage
If there is no TPM device in the device tree, the TpmBase variable is not initialized and contains garbage. Instead of using 0 as sentinel (which may be a valid address), check the size instead, which cannot be 0 for a memory-mapped device. Signed-off-by: Fabian Vogt <fvogt@suse.de>
This commit is contained in:
parent
4d38389e0f
commit
b5d1689447
1 changed files with 6 additions and 1 deletions
|
|
@ -119,6 +119,11 @@ SetupTPMResources (
|
|||
UINT64 TpmBase;
|
||||
UINT64 TpmBaseSize;
|
||||
|
||||
//
|
||||
// Empty TpmBaseSize indicates no TPM found.
|
||||
//
|
||||
TpmBaseSize = 0;
|
||||
|
||||
//
|
||||
// Set Parent to suppress incorrect compiler/analyzer warnings.
|
||||
//
|
||||
|
|
@ -200,7 +205,7 @@ SetupTPMResources (
|
|||
}
|
||||
}
|
||||
|
||||
if (TpmBase) {
|
||||
if (TpmBaseSize > 0) {
|
||||
BuildResourceDescriptorHob (
|
||||
EFI_RESOURCE_MEMORY_MAPPED_IO,
|
||||
EFI_RESOURCE_ATTRIBUTE_PRESENT |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue