aboutsummaryrefslogtreecommitdiff
path: root/linux-user/elfload.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/elfload.c')
-rw-r--r--linux-user/elfload.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 140a971632..c6731013fd 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2209,9 +2209,8 @@ static uintptr_t pgd_find_hole_fallback(uintptr_t guest_size, uintptr_t brk,
void * mmap_start = mmap((void *) align_start, guest_size,
PROT_NONE, flags, -1, 0);
if (mmap_start != MAP_FAILED) {
- munmap((void *) align_start, guest_size);
- if (MAP_FIXED_NOREPLACE != 0 ||
- mmap_start == (void *) align_start) {
+ munmap(mmap_start, guest_size);
+ if (mmap_start == (void *) align_start) {
return (uintptr_t) mmap_start + offset;
}
}
@@ -2236,7 +2235,8 @@ static uintptr_t pgb_find_hole(uintptr_t guest_loaddr, uintptr_t guest_size,
brk = (uintptr_t)sbrk(0);
if (!maps) {
- return pgd_find_hole_fallback(guest_size, brk, align, offset);
+ ret = pgd_find_hole_fallback(guest_size, brk, align, offset);
+ return ret == -1 ? -1 : ret - guest_loaddr;
}
/* The first hole is before the first map entry. */