]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Mem/Page.c
MdeModulePkg/DxeCore: deal with allocations spanning several memmap entries
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Mem / Page.c
index 260a30a214c7117a148e61863c4657f6366a6c45..3b3b9a8131a2a0c35fb7f09dfb41dcc873821f5f 100644 (file)
@@ -754,6 +754,17 @@ CoreConvertPagesEx (
       return EFI_NOT_FOUND;\r
     }\r
 \r
+    //\r
+    // If we are converting the type of the range from EfiConventionalMemory to\r
+    // another type, we have to ensure that the entire range is covered by a\r
+    // single entry.\r
+    //\r
+    if (ChangingType && (NewType != EfiConventionalMemory)) {\r
+      if (Entry->End < End) {\r
+        DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: range %lx - %lx covers multiple entries\n", Start, End));\r
+        return EFI_NOT_FOUND;\r
+      }\r
+    }\r
     //\r
     // Convert range to the end, or to the end of the descriptor\r
     // if that's all we've got\r