mm/pmm: Add pointer alignment check to pmm_free
diff --git a/common/mm/pmm.s2.c b/common/mm/pmm.s2.c
index 6b921a5c..7edcec52 100644
--- a/common/mm/pmm.s2.c
+++ b/common/mm/pmm.s2.c
@@ -586,6 +586,8 @@ void pmm_free_size_t(void *ptr, size_t length) {
}
void pmm_free(void *ptr, uint64_t count) {
+ if ((uintptr_t)ptr % 4096 != 0)
+ panic(false, "pmm_free: Unaligned pointer %p", ptr);
count = ALIGN_UP(count, 4096, panic(false, "Alignment overflow"));
if (allocations_disallowed)
panic(false, "Memory allocations disallowed");
