diff options
author | dzwdz | 2023-09-06 21:23:55 +0200 |
---|---|---|
committer | dzwdz | 2023-09-06 21:23:55 +0200 |
commit | cfaf50eac5d649b9206985328ffc118cf1b1bc1e (patch) | |
tree | 1de9424883ee70fc73a18bbb97b54381539cbce2 /src/kernel/malloc.c | |
parent | 59dfa24f6f944ab769b7c6101e2ce386ed5b9579 (diff) |
kernel: fix panic with large initrd
Diffstat (limited to 'src/kernel/malloc.c')
-rw-r--r-- | src/kernel/malloc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/kernel/malloc.c b/src/kernel/malloc.c index 0cfcc68..409a487 100644 --- a/src/kernel/malloc.c +++ b/src/kernel/malloc.c @@ -59,7 +59,8 @@ void mem_reserve(void *addr, size_t len) { len += off; size_t first = ((uintptr_t)addr - (uintptr_t)pbitmap_start) / PAGE_SIZE; for (size_t i = 0; i * PAGE_SIZE < len; i++) { - if (first + i >= pbitmap_len) break; + if ((first + i) / 8 >= pbitmap_len) + break; if (bitmap_get(first + i)) panic_invalid_state(); bitmap_set(first + i, true); |