Kernel: kmalloc does not check for corruptiong unless it cannot allocate

We 'don't care' if kmalloc is corrupted unless it prevents us from
allocating memory. Scheduler should be catching stack overflows either
way and is much more efficient
This commit is contained in:
Bananymous 2023-04-12 00:24:02 +03:00
parent 12779cdef8
commit ff7c50c627
1 changed files with 2 additions and 5 deletions

View File

@ -341,9 +341,7 @@ void* kmalloc(size_t size, size_t align)
if (ptrdiff_t rem = size % s_kmalloc_min_align)
size += s_kmalloc_min_align - rem;
ASSERT(!is_corrupted());
if (void* res = kmalloc_impl(size, align))
return res;
@ -352,6 +350,7 @@ void* kmalloc(size_t size, size_t align)
dwarnln(" {6H} free", s_kmalloc_info.free);
debug_dump();
Debug::dump_stack_trace();
ASSERT(!is_corrupted());
return nullptr;
}
@ -399,8 +398,6 @@ void kfree(void* address)
}
else if (s_kmalloc_info.base <= address_uint && address_uint < s_kmalloc_info.end)
{
ASSERT(!is_corrupted());
auto& info = s_kmalloc_info;
auto* node = info.from_address(address);