:: commit 6f21d2c530b0cdfbcda5e7f700c18107999d32da

Mintsuki <mintsuki@protonmail.com> — 2026-05-01 22:51

parents: eb20b8fc03

mm/pmm: Drop zero-length entries of any type during sanitise

diff --git a/common/mm/pmm.s2.c b/common/mm/pmm.s2.c
index 7edcec52..b2707622 100644
--- a/common/mm/pmm.s2.c
+++ b/common/mm/pmm.s2.c
@@ -179,12 +179,10 @@ del_mm0:
         }
     }
 
-    // Remove 0 length usable entries and usable entries below 0x1000
+    // Remove 0 length entries (any type) and clip usable entries below 0x1000
     for (size_t i = 0; i < count; i++) {
-        if (m[i].type != MEMMAP_USABLE)
-            continue;
-
-        if (!pmm_sanitiser_keep_first_page && m[i].base < 0x1000) {
+        if (m[i].type == MEMMAP_USABLE
+         && !pmm_sanitiser_keep_first_page && m[i].base < 0x1000) {
             uint64_t entry_top = CHECKED_ADD(m[i].base, m[i].length, goto del_mm1);
             if (entry_top <= 0x1000) {
                 goto del_mm1;
tab: 248 wrap: offon