Commit 8375eba2 authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] error code for msync()

SuSv3 says: "The msync() function shall fail if:

[EBUSY]
    Some or all of the addresses in the range starting at addr and
    continuing for len bytes are locked, and MS_INVALIDATE is
    specified.

[EINVAL]
    The value of flags is invalid.

[EINVAL]
    The value of addr is not a multiple of the page size {PAGESIZE}.

[ENOMEM]
    The addresses in the range starting at addr and continuing for len
    bytes are outside the range allowed for the address space of a process
    or specify one or more pages that are not mapped."

This fixes error code of msync() of the EINVAL case.
parent b8bbd139
......@@ -169,17 +169,18 @@ asmlinkage long sys_msync(unsigned long start, size_t len, int flags)
{
unsigned long end;
struct vm_area_struct * vma;
int unmapped_error, error = -ENOMEM;
int unmapped_error, error = -EINVAL;
down_read(&current->mm->mmap_sem);
if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC))
goto out;
if (start & ~PAGE_MASK)
goto out;
error = -ENOMEM;
len = (len + ~PAGE_MASK) & PAGE_MASK;
end = start + len;
if (end < start)
goto out;
if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC))
goto out;
error = 0;
if (end == start)
goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment