OcMemoryLib: Avoid rebuilding attributes when MAT is empty (#304)

Some firmware implementations may provide an empty Memory Attributes
Table (NumberOfEntries is zero). Avoid calling OcUpdateDescriptors in
this case, as it will lead to division by zero.

This resolves boot failures due to #DE on XPS 15 9560 when Secure Boot
is enabled.
This commit is contained in:
Alex James 2021-12-05 01:37:11 -08:00 committed by GitHub
parent 18e32b6053
commit c466fbc0f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -438,7 +438,7 @@ OcRebuildAttributes (
UINT32 DescriptorVersion;
MemoryAttributesTable = OcGetMemoryAttributes (&MemoryAttributesEntry);
if (MemoryAttributesTable == NULL) {
if (MemoryAttributesTable == NULL || MemoryAttributesTable->NumberOfEntries == 0) {
return EFI_UNSUPPORTED;
}