MdeModulePkg/Core: Fix incorrect memory map generated in a rare case

The root cause is that mImagePropertiesPrivateData.CodeSegmentCountMax was
not updated with correct value due to the fact that SortImageRecord() called
before might change the content of current ImageRecord. This will in turn
cause incorrect memory map entries generated in SplitTable().

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
Jian J Wang 2017-12-16 17:22:35 +08:00 committed by Star Zeng
parent e9dfa1b519
commit 3d817fd11a
2 changed files with 4 additions and 4 deletions

View File

@ -1229,12 +1229,12 @@ InsertImageRecord (
InsertTailList (&mImagePropertiesPrivateData.ImageRecordList, &ImageRecord->Link);
mImagePropertiesPrivateData.ImageRecordCount++;
SortImageRecord ();
if (mImagePropertiesPrivateData.CodeSegmentCountMax < ImageRecord->CodeSegmentCount) {
mImagePropertiesPrivateData.CodeSegmentCountMax = ImageRecord->CodeSegmentCount;
}
SortImageRecord ();
Finish:
return ;
}

View File

@ -1214,12 +1214,12 @@ SmmInsertImageRecord (
InsertTailList (&mImagePropertiesPrivateData.ImageRecordList, &ImageRecord->Link);
mImagePropertiesPrivateData.ImageRecordCount++;
SortImageRecord ();
if (mImagePropertiesPrivateData.CodeSegmentCountMax < ImageRecord->CodeSegmentCount) {
mImagePropertiesPrivateData.CodeSegmentCountMax = ImageRecord->CodeSegmentCount;
}
SortImageRecord ();
Finish:
return ;
}