Skip to contentSkip to conversation

powerpc/sstep: Return directly after a failed address_ok() in emulate_step()

PATCH Applied SF Markus Elfring 2 participants 2 messages Jan 21, 2017 – Jan 27, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/sstep: Return directly after a failed address_ok() in emulate_step()

From: Markus Elfring <[email protected]>
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.

---
 arch/powerpc/lib/sstep.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/lib/sstep.c +2 -4
index 9c78a9c102c3..c33519c25b47 100644
@@ -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:
Signature · 1 line
2.11.0
#1 lore raw
Quoted 6 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 21 Jan 2017 15:30:15 +0100

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

Quoted 6 lines

This issue was detected by using the Coccinelle software.

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

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/3c4b66a6d0d2b9f2418f9a09d528e4

cheers