Messages in this thread Patch in this message | | | From | Yang Yi <> | Subject | [PATCH] mips/mm/mmap: fix the wrong return value from syscall mmap() on mips architecture | Date | Wed, 25 Jul 2018 15:16:27 +0800 |
| |
According to the latest POSIX standard defined in IEEE Std 1003.1-2017, the errno should be set to ENOMEM instead of EINVAL when mmap into high region address which exceeds the address boundary of a process.
The corresponding description of IEEE Std 1003.1-2017 is as follows:
ERRORS The mmap() function shall fail if: ...... [ENOMEM] MAP_FIXED was specified, and the range [addr,addr+len) exceeds that allowed for the address space of a process; or, if MAP_FIXED was not specified and there is insufficient room in the address space to effect the mapping. ...... Signed-off-by: Yang Yi <yang.yi@zte.com.cn> Signed-off-by: Hailong Liu <liu.hailong6@zte.com.cn> Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn> --- arch/mips/mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c index 2f616eb..c47059c 100755 --- a/arch/mips/mm/mmap.c +++ b/arch/mips/mm/mmap.c @@ -69,7 +69,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp, if (flags & MAP_FIXED) { /* Even MAP_FIXED mappings must reside within TASK_SIZE */ if (TASK_SIZE - len < addr) - return -EINVAL; + return -ENOMEM;
/* * We do not accept a shared mapping if it would violate -- 2.1.0.GIT
| |