mem: fix logical errors in slab and GP allocators

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-06 01:56:15 +02:00
commit 143712194f
2 changed files with 5 additions and 2 deletions

View file

@ -47,8 +47,11 @@ void *kalloc(size_t size, u64 flags)
for (size_t i = 0; i < n_slab_sizes; i++) {
mem_cache_t *slab = kalloc_slab_array[i];
if (slab->item_size <= size) {
if (slab->item_size >= size) {
ret = slab_alloc(slab);
if (ret)
size = slab->item_size;
break;
}
}
}