From 2734353a5d567d7b3124589ca2d4993154404f28 Mon Sep 17 00:00:00 2001 From: apio Date: Tue, 6 Dec 2022 18:21:19 +0100 Subject: [PATCH] Heap: Just align it on a 16-byte boundary if it's not aligned --- kernel/src/memory/Heap.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/src/memory/Heap.cpp b/kernel/src/memory/Heap.cpp index 31a1004c..b77a0646 100644 --- a/kernel/src/memory/Heap.cpp +++ b/kernel/src/memory/Heap.cpp @@ -85,8 +85,7 @@ static usize get_fair_offset_to_split_at(HeapBlock* block, usize min) available -= (available / 2); // reserve half of the rest for the new block, while still leaving another half for the old one. - check(is_aligned(available, - 16UL)); // If necessary, we can just align it. This is more of a sanity check than a requirement. + available = align_down(available, 16UL); // Everything has to be aligned on a 16-byte boundary return available + block->req_size; }