From 24d1080c716098273cea3e40b4bbcde236b222dc Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 18 Jul 2024 21:01:54 -0400 Subject: kernel: elf: Fix loadmap indexing Signed-off-by: Ian Moffett --- sys/kern/exec_elf64.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys') 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; } } -- cgit v1.2.3