Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1564146 > unrolled thread

[PATCH] powerpc/mm: Return directly after a failed __copy_from_user() in sys_subpage_prot()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-01-21 16:30 +0100
Last post2017-01-27 01:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] powerpc/mm: Return directly after a failed __copy_from_user()  in sys_subpage_prot() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-21 16:30 +0100
    Re: powerpc/mm: Return directly after a failed __copy_from_user() in sys_subpage_prot() Michael Ellerman <patch-notifications@ellerman.id.au> - 2017-01-27 01:50 +0100

#1564146 — [PATCH] powerpc/mm: Return directly after a failed __copy_from_user() in sys_subpage_prot()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-01-21 16:30 +0100
Subject[PATCH] powerpc/mm: Return directly after a failed __copy_from_user() in sys_subpage_prot()
Message-ID<t25M5-5AY-5@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 16:10:50 +0100

* Return directly after a call of the function "__copy_from_user"
  failed here.

  This issue was detected by using the Coccinelle software.

* Delete the jump label "out2" which became unnecessary with
  this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/powerpc/mm/subpage-prot.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/powerpc/mm/subpage-prot.c b/arch/powerpc/mm/subpage-prot.c
index d5543514c1df..40309edd7cb7 100644
--- a/arch/powerpc/mm/subpage-prot.c
+++ b/arch/powerpc/mm/subpage-prot.c
@@ -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;
 }
-- 
2.11.0

[toc] | [next] | [standalone]


#1567842 — Re: powerpc/mm: Return directly after a failed __copy_from_user() in sys_subpage_prot()

FromMichael Ellerman <patch-notifications@ellerman.id.au>
Date2017-01-27 01:50 +0100
SubjectRe: powerpc/mm: Return directly after a failed __copy_from_user() in sys_subpage_prot()
Message-ID<t42TM-5O4-21@gated-at.bofh.it>
In reply to#1564146
On Sat, 2017-01-21 at 15:24:58 UTC, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 16:10:50 +0100
> 
> * Return directly after a call of the function "__copy_from_user"
>   failed here.
> 
>   This issue was detected by using the Coccinelle software.
> 
> * Delete the jump label "out2" which became unnecessary with
>   this refactoring.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/a967f161abc7c4a6936ceb15737f75

cheers

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web