powerpc/mm: Return directly after a failed __copy_from_user() in sys_subpage_prot()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 21 Jan 2017 15:10:50 +0000 (16:10 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 25 Jan 2017 02:34:22 +0000 (13:34 +1100)
This function already has multiple exit points, so there's no harm
adding another. Although it looks odd to return directly in a function
which takes a lock, we've actually just dropped the mmap_sem in this
code, so there's really no reason to go via a label. And it means we can
drop the unhelpfully named out2 label.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
[mpe: Rewrite change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/subpage-prot.c

index 5c096c01e8bd876b184c1d018bec2fbc04f29a30..94210940112f808311bcf263c968dd800d3cf7c2 100644 (file)
@@ -248,9 +248,8 @@ long sys_subpage_prot(unsigned long addr, unsigned long len, u32 __user *map)
                        nw = (next - addr) >> PAGE_SHIFT;
 
                up_write(&mm->mmap_sem);
-               err = -EFAULT;
                if (__copy_from_user(spp, map, nw * sizeof(u32)))
-                       goto out2;
+                       return -EFAULT;
                map += nw;
                down_write(&mm->mmap_sem);
 
@@ -262,6 +261,5 @@ long sys_subpage_prot(unsigned long addr, unsigned long len, u32 __user *map)
        err = 0;
  out:
        up_write(&mm->mmap_sem);
- out2:
        return err;
 }