diff options
author | Ian Moffett <ian@osmora.org> | 2024-07-18 21:01:54 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-07-18 21:01:54 -0400 |
commit | 24d1080c716098273cea3e40b4bbcde236b222dc (patch) | |
tree | a7c5363c5aeefdcc440a5ffe5a0081991470dd15 /sys/kern/exec_elf64.c | |
parent | e234e602429ebe82836d2f6cae730f2a11dc2fc0 (diff) |
kernel: elf: Fix loadmap indexing
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern/exec_elf64.c')
-rw-r--r-- | sys/kern/exec_elf64.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/exec_elf64.c b/sys/kern/exec_elf64.c index d9a3bb9..4dbc3aa 100644 --- a/sys/kern/exec_elf64.c +++ b/sys/kern/exec_elf64.c @@ -177,6 +177,7 @@ elf64_load(const char *pathname, struct proc *td, struct exec_prog *prog) struct pcb *pcbp; struct exec_range loadmap[MAX_PHDRS]; struct auxval *auxvalp; + size_t loadmap_idx = 0; int status = 0; if ((status = elf_get_file(pathname, &file)) != 0) @@ -219,9 +220,9 @@ elf64_load(const char *pathname, struct proc *td, struct exec_prog *prog) tmp = (void *)((uintptr_t)hdr + phdr->p_offset); memcpy(PHYS_TO_VIRT(physmem), tmp, phdr->p_filesz); - loadmap[i].start = physmem; - loadmap[i].end = physmem + map_len; - loadmap[i].vbase = phdr->p_vaddr; + loadmap[loadmap_idx].start = physmem; + loadmap[loadmap_idx].end = physmem + map_len; + loadmap[loadmap_idx].vbase = phdr->p_vaddr; } } |