Skip to content
Permalink
Browse files

Fix pos to be an offset of entry

pos needs to also include the first 8 bytes of multiboot2_tag_t so that
it represents an offset from the beginning of the tag and points to
entry.
  • Loading branch information
jermar committed May 16, 2019
1 parent a548528 commit 6aeb60f6e41ab8e130e28157f9878a1eaab9bc96
Showing with 1 addition and 1 deletion.
  1. +1 −1 kernel/genarch/src/multiboot/multiboot2.c
@@ -64,7 +64,7 @@ static void multiboot2_memmap(uint32_t length, const multiboot2_memmap_t *memmap
{
multiboot2_memmap_entry_t *entry = (multiboot2_memmap_entry_t *)
((uintptr_t) memmap + sizeof(*memmap));
uint32_t pos = sizeof(*memmap);
uint32_t pos = offsetof(multiboot2_tag_t, memmap) + sizeof(*memmap);

while ((pos < length) && (e820counter < MEMMAP_E820_MAX_RECORDS)) {
e820table[e820counter].base_address = entry->base_address;

0 comments on commit 6aeb60f

Please sign in to comment.
You can’t perform that action at this time.