mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 05:35:52 +03:00
Kernel: Assert that a KmallocSubheap fits inside a page
Since we allocate the subheap in the first page of the given storage let's assert that the subheap can actually fit in a single page, to prevent the possible future headache of trying to debug the cause of random kernel memory corruption :^)
This commit is contained in:
parent
1c99f99e99
commit
7757d874ad
Notes:
sideshowbarker
2024-07-17 22:10:44 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/7757d874adc Pull-request: https://github.com/SerenityOS/serenity/pull/11427 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/awesomekling ✅
@ -58,6 +58,7 @@ struct KmallocGlobalData {
|
||||
void add_subheap(u8* storage, size_t storage_size)
|
||||
{
|
||||
dbgln("Adding kmalloc subheap @ {} with size {}", storage, storage_size);
|
||||
static_assert(sizeof(KmallocSubheap) <= PAGE_SIZE);
|
||||
auto* subheap = new (storage) KmallocSubheap(storage + PAGE_SIZE, storage_size - PAGE_SIZE);
|
||||
subheaps.append(*subheap);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user