diff options
Diffstat (limited to 'src/kernel/malloc.c')
-rw-r--r-- | src/kernel/malloc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/kernel/malloc.c b/src/kernel/malloc.c index 8ba00dc..ba1ab42 100644 --- a/src/kernel/malloc.c +++ b/src/kernel/malloc.c @@ -116,6 +116,7 @@ mem_debugprint(void) void *page_alloc(size_t pages) { + assert(pages == 1); /* not using that assertion... yet */ /* i do realize how painfully slow this is */ size_t streak = 0; for (size_t i = pbitmap_firstfree; i < pbitmap_len * 8; i++) { @@ -177,7 +178,11 @@ void Allocation *hdr; void *addr; + if (KMALLOC_MAX < len) { + panic_invalid_state(); + } len += sizeof(Allocation); + assert(len <= PAGE_SIZE); hdr = page_alloc(page_amt(len)); hdr->magic = MALLOC_MAGIC; hdr->len = len; |