linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/sstep: Return directly after a failed address_ok() in emulate_step()
@ 2017-01-21 14:45 SF Markus Elfring
  2017-01-27  0:40 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: SF Markus Elfring @ 2017-01-21 14:45 UTC (permalink / raw)
  To: linuxppc-dev, Benjamin Herrenschmidt, Lennart Sorensen,
	Michael Ellerman, Nicholas Piggin, Oliver O'Halloran,
	Paul Mackerras
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 15:30:15 +0100

* Return directly after a call of the function "address_ok" failed
  in a case block.

  This issue was detected by using the Coccinelle software.

* Delete two error code assignments which became unnecessary with
  this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/powerpc/lib/sstep.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 9c78a9c102c3..c33519c25b47 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1803,9 +1803,8 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
 			return 0;
 		if (op.ea & (size - 1))
 			break;		/* can't handle misaligned */
-		err = -EFAULT;
 		if (!address_ok(regs, op.ea, size))
-			goto ldst_done;
+			return 0;
 		err = 0;
 		switch (size) {
 		case 4:
@@ -1828,9 +1827,8 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
 			return 0;
 		if (op.ea & (size - 1))
 			break;		/* can't handle misaligned */
-		err = -EFAULT;
 		if (!address_ok(regs, op.ea, size))
-			goto ldst_done;
+			return 0;
 		err = 0;
 		switch (size) {
 		case 4:
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: powerpc/sstep: Return directly after a failed address_ok() in emulate_step()
  2017-01-21 14:45 [PATCH] powerpc/sstep: Return directly after a failed address_ok() in emulate_step() SF Markus Elfring
@ 2017-01-27  0:40 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2017-01-27  0:40 UTC (permalink / raw)
  To: SF Markus Elfring, linuxppc-dev, Benjamin Herrenschmidt,
	Lennart Sorensen, Nicholas Piggin, Oliver O'Halloran,
	Paul Mackerras
  Cc: kernel-janitors, LKML

On Sat, 2017-01-21 at 14:45:19 UTC, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 15:30:15 +0100
> 
> * Return directly after a call of the function "address_ok" failed
>   in a case block.
> 
>   This issue was detected by using the Coccinelle software.
> 
> * Delete two error code assignments 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/3c4b66a6d0d2b9f2418f9a09d528e4

cheers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-27  0:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-21 14:45 [PATCH] powerpc/sstep: Return directly after a failed address_ok() in emulate_step() SF Markus Elfring
2017-01-27  0:40 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).