]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions
[mirror_edk2.git] / ArmPkg / Library / ArmMmuLib / Arm / ArmMmuLibCore.c
index b237321a8d8b91f1f10ace2b63418895505cd935..bffab83d4fd0bbe1571fbab9ca3ae0c879a6357b 100644 (file)
@@ -294,8 +294,8 @@ FillTranslationTable (
       PhysicalBase += TT_DESCRIPTOR_SECTION_SIZE;\r
       RemainLength -= TT_DESCRIPTOR_SECTION_SIZE;\r
     } else {\r
-      PageMapLength = MIN (RemainLength, TT_DESCRIPTOR_SECTION_SIZE) -\r
-                      (PhysicalBase % TT_DESCRIPTOR_SECTION_SIZE);\r
+      PageMapLength = MIN (RemainLength, TT_DESCRIPTOR_SECTION_SIZE -\r
+                                         (PhysicalBase % TT_DESCRIPTOR_SECTION_SIZE));\r
 \r
       // Case: Physical address aligned on the Section Size (1MB) && the length\r
       //       does not fill a section\r
@@ -744,6 +744,10 @@ ArmSetMemoryAttributes (
   UINT64        ChunkLength;\r
   BOOLEAN       FlushTlbs;\r
 \r
+  if (BaseAddress > (UINT64)MAX_ADDRESS - Length + 1) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   if (Length == 0) {\r
     return EFI_SUCCESS;\r
   }\r