From: Warner Losh Date: Fri, 30 Apr 2021 00:47:51 +0000 (-0600) Subject: bsd-user: Fix calculation of size to allocate X-Git-Tag: qemu-xen-4.17.0-rc4~336^2~33 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=223005f0584ece2868b0b5ac11b06f3984aad569;p=qemu-xen.git bsd-user: Fix calculation of size to allocate 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 Reviewed-by: Richard Henderson --- diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c index 5282a7c4f2..379015c744 100644 --- a/bsd-user/bsdload.c +++ b/bsd-user/bsdload.c @@ -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; }