[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/13] linux-user: assert that target_mprotect cannot
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 13/13] linux-user: assert that target_mprotect cannot fail |
Date: |
Fri, 2 Oct 2015 16:01:05 +0300 |
From: Paolo Bonzini <address@hidden>
All error conditions that target_mprotect checks are also checked
by target_mmap. EACCESS cannot happen because we are just removing
PROT_WRITE. ENOMEM should not happen because we are modifying a
whole VMA (and we have bigger problems anyway if it happens).
Fixes a Coverity false positive, where Coverity complains about
target_mprotect's return value being passed to tb_invalidate_phys_range.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/mmap.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index b2126c7..5606bcd 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -514,10 +514,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int
prot,
goto fail;
if (!(prot & PROT_WRITE)) {
ret = target_mprotect(start, len, prot);
- if (ret != 0) {
- start = ret;
- goto the_end;
- }
+ assert(ret == 0);
}
goto the_end;
}
--
2.5.3
- [Qemu-devel] [PULL 00/13] linux-user queque, riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 10/13] linux-user: add name_to_handle_at/open_by_handle_at, riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 09/13] linux-user: Return target error number in do_fork(), riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 11/13] linux-user/syscall.c: Add EAGAIN to host_to_target_errno_table for, riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 12/13] linux-user/signal.c: Use setup_rt_frame() instead of setup_frame() for target openrisc, riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 05/13] linux-user: Treat --foo options the same as -foo, riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 13/13] linux-user: assert that target_mprotect cannot fail,
riku . voipio <=
- [Qemu-devel] [PULL 01/13] linux-user: Exit 0 when -h is used, riku . voipio, 2015/10/08
- Re: [Qemu-devel] [PULL 00/13] linux-user queque, Peter Maydell, 2015/10/08
- [Qemu-devel] [PULL 02/13] linux-user: Add -help, riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 03/13] linux-user: Add proper error messages for bad options, riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 07/13] linux-user: remove MAX_ARG_PAGES limit, riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 08/13] linux-user: fix cmsg conversion in case of multiple headers, riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 06/13] linux-user: remove unused image_info members, riku . voipio, 2015/10/08
- [Qemu-devel] [PULL 04/13] linux-user: use EXIT_SUCCESS and EXIT_FAILURE, riku . voipio, 2015/10/08