summaryrefslogtreecommitdiff
path: root/kernel/mboot
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/mboot')
-rw-r--r--kernel/mboot/mmap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/mboot/mmap.c b/kernel/mboot/mmap.c
index e0963ca..d1d3d9a 100644
--- a/kernel/mboot/mmap.c
+++ b/kernel/mboot/mmap.c
@@ -1,3 +1,5 @@
+#include "comus/memory.h"
+#include "lib/klib.h"
#include <lib.h>
#include <comus/mboot.h>
@@ -32,6 +34,8 @@ int mboot_get_mmap(struct memory_map *res)
uintptr_t i = (uintptr_t)mmap->entries;
for (; i < (uintptr_t)mmap->entries + mmap->size;
i += mmap->entry_size, idx++) {
+ if (idx >= N_MMAP_ENTRY)
+ panic("Too many mmap entries: limit is %d", N_MMAP_ENTRY);
struct multiboot_mmap_entry *seg = (struct multiboot_mmap_entry *)i;
res->entries[idx].addr = seg->addr;
res->entries[idx].len = seg->len;