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.
{
unsigned long end;
struct vm_area_struct * vma;
- int unmapped_error, error = -ENOMEM;
+ int unmapped_error, error = -EINVAL;
down_read(¤t->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;