diff options
author | Dandan Bi <dandan.bi@intel.com> | 2018-07-02 13:29:52 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2018-07-04 10:42:36 +0800 |
commit | dd3907f221fd9b774a5734cb7a000377acdfd5ca (patch) | |
tree | 6d25ebb62db0b49fd4fe34db1416c42fe90f95dd /MdeModulePkg/Library | |
parent | 5895956dd955714c0e578a413d0e289153cc9eea (diff) | |
download | edk2-dd3907f221fd9b774a5734cb7a000377acdfd5ca.zip edk2-dd3907f221fd9b774a5734cb7a000377acdfd5ca.tar.gz edk2-dd3907f221fd9b774a5734cb7a000377acdfd5ca.tar.bz2 |
MdeModulePkg/SmmCorePerformanceLib: Update mPerformanceLength
In mSmmBootPerformanceTable there are two parts,
one is the FPDT table header and the other is FPDT records.
Currently:
mPerformanceLength: The length of existing FPDT records.
mMaxPerformanceLength: The maximum length allocated for
mSmmBootPerformanceTable(including FPDT table header length
and existing FPDT records length)
But when compare mPerformanceLength with mMaxPerformanceLength
to check whether need to allocate new buffer for new FPDT
record, we miss to add mPerformanceLength with header length,
which will cause pool allocation behavior is not correct.
Now update the mPerformanceLength to fix this issue:
updated mPerformanceLength = FPDT table header length
+ existing FPDT records length.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r-- | MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c index f18c3fb..e03d41e 100644 --- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c +++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c @@ -45,7 +45,7 @@ typedef struct { HANDLE_GUID_MAP mCacheHandleGuidTable[CACHE_HANDLE_GUID_COUNT];
UINTN mCachePairCount = 0;
-UINT32 mPerformanceLength = 0;
+UINT32 mPerformanceLength = sizeof (SMM_BOOT_PERFORMANCE_TABLE);
UINT32 mMaxPerformanceLength = 0;
UINT32 mLoadImageCount = 0;
BOOLEAN mFpdtDataIsReported = FALSE;
@@ -100,15 +100,15 @@ GetFpdtRecordPtr ( if (mPerformanceLength + RecordSize > mMaxPerformanceLength) {
mSmmBootPerformanceTable = ReallocatePool (
mPerformanceLength,
- mPerformanceLength + sizeof (SMM_BOOT_PERFORMANCE_TABLE) + RecordSize + FIRMWARE_RECORD_BUFFER,
+ mPerformanceLength + RecordSize + FIRMWARE_RECORD_BUFFER,
mSmmBootPerformanceTable
);
if (mSmmBootPerformanceTable == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- mSmmBootPerformanceTable->Header.Length = sizeof (SMM_BOOT_PERFORMANCE_TABLE) + mPerformanceLength;
- mMaxPerformanceLength = mPerformanceLength + sizeof (SMM_BOOT_PERFORMANCE_TABLE) + RecordSize + FIRMWARE_RECORD_BUFFER;
+ mSmmBootPerformanceTable->Header.Length = mPerformanceLength;
+ mMaxPerformanceLength = mPerformanceLength + RecordSize + FIRMWARE_RECORD_BUFFER;
}
//
// Covert buffer to FPDT Ptr Union type.
|