Skip to contentSkip to conversation

linux-user: mprotect() should returns 0 when len is 0.

PATCH Superseded Soichiro Isshiki 1 participant 1 message Oct 6, 2022

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: mprotect() should returns 0 when len is 0.

From: sisshiki1969 <[email protected]>

---
 linux-user/mmap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
linux-user/mmap.c +3 -3
index 28f3bc85ed..1ed79459ea 100644
@@ -130,12 +130,12 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot)
     }
     len = TARGET_PAGE_ALIGN(len);
     end = start + len;
-    if (!guest_range_valid_untagged(start, len)) {
-        return -TARGET_ENOMEM;
-    }
     if (len == 0) {
         return 0;
     }
+    if (!guest_range_valid_untagged(start, len)) {
+        return -TARGET_ENOMEM;
+    }
 
     mmap_lock();
     host_start = start & qemu_host_page_mask;
Signature · 1 line
2.25.1