[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] linux-user/mmap.c: fix integer underflow during mremap shrink
From: |
Jonathan Marler |
Subject: |
[PATCH] linux-user/mmap.c: fix integer underflow during mremap shrink |
Date: |
Fri, 1 May 2020 21:50:48 -0600 |
Signed-off-by: Jonathan Marler <address@hidden>
---
linux-user/mmap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index e378033797..da0fe4cc86 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -708,7 +708,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong
old_size,
if (prot == 0) {
host_addr = mremap(g2h(old_addr), old_size, new_size, flags);
if (host_addr != MAP_FAILED && reserved_va && old_size > new_size)
{
- mmap_reserve(old_addr + old_size, new_size - old_size);
+ if (new_size > old_size)
+ mmap_reserve(old_addr + old_size, new_size - old_size);
}
} else {
errno = ENOMEM;
--
2.23.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] linux-user/mmap.c: fix integer underflow during mremap shrink,
Jonathan Marler <=