aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/flatload.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/linux-user/flatload.c b/linux-user/flatload.c
index 2eefe55..0122ab3 100644
--- a/linux-user/flatload.c
+++ b/linux-user/flatload.c
@@ -771,10 +771,10 @@ int load_flt_binary(struct linux_binprm *bprm, struct image_info *info)
/* Enforce final stack alignment of 16 bytes. This is sufficient
for all current targets, and excess alignment is harmless. */
stack_len = bprm->envc + bprm->argc + 2;
- stack_len += 3; /* argc, arvg, argp */
+ stack_len += flat_argvp_envp_on_stack() ? 2 : 0; /* arvg, argp */
+ stack_len += 1; /* argc */
stack_len *= sizeof(abi_ulong);
- if ((sp + stack_len) & 15)
- sp -= 16 - ((sp + stack_len) & 15);
+ sp -= (sp - stack_len) & 15;
sp = loader_build_argptr(bprm->envc, bprm->argc, sp, p,
flat_argvp_envp_on_stack());