{
unsigned long end;
struct vm_area_struct *vma;
- int unmapped_error, error = -EINVAL;
+ int unmapped_error = 0;
+ int error = -EINVAL;
int done = 0;
if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC))
if (flags & MS_SYNC)
current->flags |= PF_SYNCWRITE;
vma = find_vma(current->mm, start);
- unmapped_error = 0;
+ if (!vma) {
+ error = -ENOMEM;
+ goto out_unlock;
+ }
do {
unsigned long nr_pages_dirtied = 0;
struct file *file;
- /* Still start < end. */
- error = -ENOMEM;
- if (!vma)
- goto out_unlock;
/* Here start < vma->vm_end. */
if (start < vma->vm_start) {
unmapped_error = -ENOMEM;
} else {
vma = vma->vm_next;
}
- } while (!done);
+ } while (vma && !done);
out_unlock:
current->flags &= ~PF_SYNCWRITE;
up_read(¤t->mm->mmap_sem);