aboutsummaryrefslogtreecommitdiff
path: root/linux-user/qemu.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/qemu.h')
-rw-r--r--linux-user/qemu.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 9fbc5ed..ba122a7 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -493,12 +493,9 @@ extern unsigned long guest_stack_size;
static inline bool access_ok(int type, abi_ulong addr, abi_ulong size)
{
- if (!guest_addr_valid(addr)) {
- return false;
- }
- if (size != 0 &&
- (addr + size - 1 < addr ||
- !guest_addr_valid(addr + size - 1))) {
+ if (size == 0
+ ? !guest_addr_valid(addr)
+ : !guest_range_valid(addr, size)) {
return false;
}
return page_check_range((target_ulong)addr, size, type) == 0;