]> Git Repo - qemu.git/commitdiff
linux-user: fix target_mprotect/target_munmap error return values
authorMax Filippov <[email protected]>
Wed, 28 Feb 2018 22:16:05 +0000 (14:16 -0800)
committerLaurent Vivier <[email protected]>
Fri, 9 Mar 2018 18:22:47 +0000 (19:22 +0100)
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: [email protected]
Cc: Riku Voipio <[email protected]>
Cc: Laurent Vivier <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Message-Id: <20180228221609[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
linux-user/mmap.c

index df81f9b803b69adb88a89e0d871a312c6a51e1d8..84b15c9a1699a2ec985bd1d73f0978220822b10c 100644 (file)
@@ -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();
This page took 0.025887 seconds and 4 git commands to generate.