summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-07-18 21:01:54 -0400
committerIan Moffett <ian@osmora.org>2024-07-18 21:01:54 -0400
commit24d1080c716098273cea3e40b4bbcde236b222dc (patch)
treea7c5363c5aeefdcc440a5ffe5a0081991470dd15 /sys/kern
parente234e602429ebe82836d2f6cae730f2a11dc2fc0 (diff)
kernel: elf: Fix loadmap indexing
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/exec_elf64.c7
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;
}
}