Skip to content

Commit 243a236

Browse files
committed
fix mremap-underflow.diff
1 parent 5b9eb3a commit 243a236

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

patch/mremap-underflow.diff

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ diff --git a/linux-user/mmap.c b/linux-user/mmap.c
22
index e378033797..da0fe4cc86 100644
33
--- a/linux-user/mmap.c
44
+++ b/linux-user/mmap.c
5-
@@ -708,7 +708,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
5+
@@ -708,7 +708,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
66
if (prot == 0) {
77
host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
88
if (host_addr != MAP_FAILED && reserved_va && old_size > new_size) {
99
- mmap_reserve(old_addr + old_size, new_size - old_size);
10-
+ if (new_size > old_size)
11-
+ mmap_reserve(old_addr + old_size, new_size - old_size);
10+
+ mmap_reserve(old_addr + old_size, old_size - new_size);
1211
}
1312
} else {
1413
errno = ENOMEM;

0 commit comments

Comments
 (0)