forked from Bananymous/banan-os
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:
parent
12779cdef8
commit
ff7c50c627
|
@ -341,9 +341,7 @@ void* kmalloc(size_t size, size_t align)
|
||||||
|
|
||||||
if (ptrdiff_t rem = size % s_kmalloc_min_align)
|
if (ptrdiff_t rem = size % s_kmalloc_min_align)
|
||||||
size += s_kmalloc_min_align - rem;
|
size += s_kmalloc_min_align - rem;
|
||||||
|
|
||||||
ASSERT(!is_corrupted());
|
|
||||||
|
|
||||||
if (void* res = kmalloc_impl(size, align))
|
if (void* res = kmalloc_impl(size, align))
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
@ -352,6 +350,7 @@ void* kmalloc(size_t size, size_t align)
|
||||||
dwarnln(" {6H} free", s_kmalloc_info.free);
|
dwarnln(" {6H} free", s_kmalloc_info.free);
|
||||||
debug_dump();
|
debug_dump();
|
||||||
Debug::dump_stack_trace();
|
Debug::dump_stack_trace();
|
||||||
|
ASSERT(!is_corrupted());
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -399,8 +398,6 @@ void kfree(void* address)
|
||||||
}
|
}
|
||||||
else if (s_kmalloc_info.base <= address_uint && address_uint < s_kmalloc_info.end)
|
else if (s_kmalloc_info.base <= address_uint && address_uint < s_kmalloc_info.end)
|
||||||
{
|
{
|
||||||
ASSERT(!is_corrupted());
|
|
||||||
|
|
||||||
auto& info = s_kmalloc_info;
|
auto& info = s_kmalloc_info;
|
||||||
|
|
||||||
auto* node = info.from_address(address);
|
auto* node = info.from_address(address);
|
||||||
|
|
Loading…
Reference in New Issue