aboutsummaryrefslogtreecommitdiff
path: root/linux-user/mmap.c
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2018-02-28 14:16:05 -0800
committerMichael Roth <mdroth@linux.vnet.ibm.com>2018-06-20 20:44:58 -0500
commite1f5a04d17d88ee490408766dfdaa814ab91895f (patch)
tree936d5c9bc3cd72b4b353d49804f41cad05defb6f /linux-user/mmap.c
parent8fc971ed1b44f7910a5ee928acccb3a70156c237 (diff)
linux-user: fix target_mprotect/target_munmap error return values
target_mprotect/target_munmap return value goes through get_errno at the call site, thus the functions must either set errno to host error code and return -1 or return negative guest error code. Do the latter. Cc: qemu-stable@nongnu.org Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180228221609.11265-8-jcmvbkbc@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu> (cherry picked from commit 78cf339039c325b336442f1d7f3ccc531b22c4a0) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'linux-user/mmap.c')
-rw-r--r--linux-user/mmap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 33a73cd29c..e0c946eae6 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -77,11 +77,11 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot)
#endif
if ((start & ~TARGET_PAGE_MASK) != 0)
- return -EINVAL;
+ return -TARGET_EINVAL;
len = TARGET_PAGE_ALIGN(len);
end = start + len;
if (!guest_range_valid(start, len)) {
- return -ENOMEM;
+ return -TARGET_ENOMEM;
}
prot &= PROT_READ | PROT_WRITE | PROT_EXEC;
if (len == 0)
@@ -621,10 +621,10 @@ int target_munmap(abi_ulong start, abi_ulong len)
start, len);
#endif
if (start & ~TARGET_PAGE_MASK)
- return -EINVAL;
+ return -TARGET_EINVAL;
len = TARGET_PAGE_ALIGN(len);
if (len == 0 || !guest_range_valid(start, len)) {
- return -EINVAL;
+ return -TARGET_EINVAL;
}
mmap_lock();