Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Commit 9a5f1a6

Browse files
kellycouchgldiviney
authored andcommitted
Check return code and propagate error. Add a check for revision on PCD header.
Signed-off-by: Kelly J Couch <kelly.j.couch@intel.com> (cherry picked from commit b386b528388c73a6ad0594f94c6977e4306a8ed5)
1 parent 39604c7 commit 9a5f1a6

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

DcpmPkg/common/PcdCommon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extern EFI_GUID gIntelDimmConfigVariableGuid;
2525
#define NVDIMM_CONFIGURATION_INPUT_SIG SIGNATURE_32('C', 'I', 'N', '_')
2626
#define NVDIMM_CONFIGURATION_OUTPUT_SIG SIGNATURE_32('C', 'O', 'U', 'T')
2727
#define NVDIMM_CONFIGURATION_HEADER_REVISION 1
28+
#define NVDIMM_CONFIGURATION_HEADER_LOWEST_COMPATIBLE_REVISION 1
2829
#define NVDIMM_CONFIGURATION_HEADER_OEM_ID "INTEL "
2930
#define NVDIMM_CONFIGURATION_HEADER_OEM_ID_LEN 6
3031
#define NVDIMM_CONFIGURATION_HEADER_OEM_TABLE_ID SIGNATURE_64('P', 'U', 'R', 'L', 'E', 'Y', ' ', ' ')

DcpmPkg/driver/Core/Dimm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,6 +2114,12 @@ EFI_STATUS ValidatePcdOemHeader(
21142114
return EFI_VOLUME_CORRUPTED;
21152115
}
21162116

2117+
if ((pOemHeader->Header.Revision > NVDIMM_CONFIGURATION_HEADER_REVISION) ||
2118+
(pOemHeader->Header.Revision < NVDIMM_CONFIGURATION_HEADER_LOWEST_COMPATIBLE_REVISION)){
2119+
NVDIMM_WARN("Unsupported revision of the DIMM Configuration Header table");
2120+
return EFI_VOLUME_CORRUPTED;
2121+
}
2122+
21172123
if (pOemHeader->Header.Length > PCD_OEM_PARTITION_INTEL_CFG_REGION_SIZE) {
21182124
NVDIMM_WARN("Length of PCD header is greater than PCD OEM partition size");
21192125
return EFI_VOLUME_CORRUPTED;

DcpmPkg/driver/Protocol/Driver/NvmDimmConfig.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3880,7 +3880,10 @@ GetMemoryResourcesInfo(
38803880
pMemoryResourcesInfo->RawCapacity += pDimm->RawCapacity;
38813881

38823882
#ifdef OS_BUILD
3883-
GetDimmMappedMemSize(pDimm);
3883+
ReturnCode = GetDimmMappedMemSize(pDimm);
3884+
if (EFI_ERROR(ReturnCode)) {
3885+
goto Finish;
3886+
}
38843887
#endif // OS_BUILD
38853888

38863889
ReturnCode = GetCapacities(pDimm->DimmID, &VolatileCapacity, &AppDirectCapacity,

0 commit comments

Comments
 (0)