From 94e96927a62277eea6f0ec1ca23ad963b8c6c649 Mon Sep 17 00:00:00 2001 From: Ken Sato Date: Sun, 17 Jun 2018 11:24:45 +0900 Subject: [PATCH] mremap: Do nothing when no size change and !MREMAP_FIXED Behave in the same way as Linux which returns old_address when old_size == new_size && !MREMAP_FIXED. Refs: #1112 Change-Id: Ice1421a8a77f962d087de8475aa2cd40c59be5f7 --- kernel/syscall.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/syscall.c b/kernel/syscall.c index 0803d26a..1f085629 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -7736,6 +7736,14 @@ SYSCALL_DECLARE(mremap) goto out; } + /* check necessity of remap */ + if (!(flags & MREMAP_FIXED) && oldsize == newsize) { + /* Nothing to do */ + error = 0; + newstart = oldaddr; + goto out; + } + if (oldend < oldstart) { error = -EINVAL; ekprintf("sys_mremap(%#lx,%#lx,%#lx,%#x,%#lx):"