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>
InsertTailList (&mImagePropertiesPrivateData.ImageRecordList, &ImageRecord->Link);\r
mImagePropertiesPrivateData.ImageRecordCount++;\r
\r
- SortImageRecord ();\r
-\r
if (mImagePropertiesPrivateData.CodeSegmentCountMax < ImageRecord->CodeSegmentCount) {\r
mImagePropertiesPrivateData.CodeSegmentCountMax = ImageRecord->CodeSegmentCount;\r
}\r
\r
+ SortImageRecord ();\r
+\r
Finish:\r
return ;\r
}\r
InsertTailList (&mImagePropertiesPrivateData.ImageRecordList, &ImageRecord->Link);\r
mImagePropertiesPrivateData.ImageRecordCount++;\r
\r
- SortImageRecord ();\r
-\r
if (mImagePropertiesPrivateData.CodeSegmentCountMax < ImageRecord->CodeSegmentCount) {\r
mImagePropertiesPrivateData.CodeSegmentCountMax = ImageRecord->CodeSegmentCount;\r
}\r
\r
+ SortImageRecord ();\r
+\r
Finish:\r
return ;\r
}\r