]> git.proxmox.com Git - mirror_qemu.git/commitdiff
bsd-user: Fix calculation of size to allocate
authorWarner Losh <imp@bsdimp.com>
Fri, 30 Apr 2021 00:47:51 +0000 (18:47 -0600)
committerWarner Losh <imp@bsdimp.com>
Fri, 10 Sep 2021 20:13:06 +0000 (14:13 -0600)
It was incorrect to subtract off the size of an unsigned int here.  In
bsd-user fork, this change was made when moving the arch specific items
to specific files.  The size in BSD that's available for the arguments
does not need a return address subtracted from it.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
bsd-user/bsdload.c

index 5282a7c4f25bcc43cd53688016774353f754be6f..379015c74441f6aa9906fadf775d7947388c540b 100644 (file)
@@ -143,10 +143,9 @@ int loader_exec(const char *filename, char **argv, char **envp,
                 struct target_pt_regs *regs, struct image_info *infop,
                 struct bsd_binprm *bprm)
 {
-    int retval;
-    int i;
+    int retval, i;
 
-    bprm->p = TARGET_PAGE_SIZE * MAX_ARG_PAGES - sizeof(unsigned int);
+    bprm->p = TARGET_PAGE_SIZE * MAX_ARG_PAGES;
     for (i = 0; i < MAX_ARG_PAGES; i++) {       /* clear page-table */
         bprm->page[i] = NULL;
     }