]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
MdeModulePkg/Core: Fix incorrect memory map generated in a rare case
[mirror_edk2.git] / MdeModulePkg / Core / PiSmmCore / MemoryAttributesTable.c
index e3c505ef18abf9b31f1f1f1b4019225525f71076..36ccf65fa362a08acb2d1282408588ba35ef3d3d 100644 (file)
@@ -1214,12 +1214,12 @@ SmmInsertImageRecord (
   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