Merge tag 'acpica-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[cascardo/linux.git] / mm / mmap.c
index bb50cac..aa632ad 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1258,6 +1258,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
 
        *populate = 0;
 
+       if (!len)
+               return -EINVAL;
+
        /*
         * Does the application expect PROT_READ to imply PROT_EXEC?
         *
@@ -1268,9 +1271,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
                if (!(file && (file->f_path.mnt->mnt_flags & MNT_NOEXEC)))
                        prot |= PROT_EXEC;
 
-       if (!len)
-               return -EINVAL;
-
        if (!(flags & MAP_FIXED))
                addr = round_hint_to_min(addr);