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
This commit is contained in:
Ken Sato
2018-06-17 11:24:45 +09:00
committed by Masamichi Takagi
parent 3636c8e7e4
commit 94e96927a6

View File

@ -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):"