From 61dfbab4f90dce8c0a28bb105afcde66a59a80e3 Mon Sep 17 00:00:00 2001 From: Haryslee Date: Fri, 16 Oct 2020 14:55:32 +0800 Subject: [PATCH] mmap fix --- kernel/base/vm/los_vm_map.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/base/vm/los_vm_map.c b/kernel/base/vm/los_vm_map.c index c4271ab0..12cecb79 100644 --- a/kernel/base/vm/los_vm_map.c +++ b/kernel/base/vm/los_vm_map.c @@ -365,7 +365,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len) if (nextStart < curEnd) { continue; } - if ((curEnd + len) <= nextStart) { + if ((nextStart - curEnd) >= len) { return curEnd; } else { curEnd = curRegion->range.base + curRegion->range.size; @@ -379,7 +379,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len) if (nextStart < curEnd) { continue; } - if ((curEnd + len) <= nextStart) { + if ((nextStart - curEnd) >= len) { return curEnd; } else { curEnd = curRegion->range.base + curRegion->range.size; @@ -388,7 +388,7 @@ VADDR_T OsAllocRange(LosVmSpace *vmSpace, size_t len) } nextStart = vmSpace->mapBase + vmSpace->mapSize; - if ((curEnd + len) <= nextStart) { + if ((nextStart >= curEnd) && ((nextStart - curEnd) >= len)) { return curEnd; } -- Gitee