Skip to contentSkip to conversation

x86_64, traps: always true condition

PATCH In review Dan Carpenter 4 participants 4 messages Nov 25, 2014 – Dec 9, 2014

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

PATCH v2 1/1 x86_64, traps: always true condition

We should be checking IS_ERR() here. PTR_ERR() is always true.

Fixes fe3d197f8431 ('x86, mpx: On-demand kernel allocation of bounds tables')

---
v2: Use correct fixes tag.

arch/x86/kernel/traps.c +1 -1
index 67d817e..f176d96 100644
@@ -331,7 +331,7 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)
 		break; /* Success, it was handled */
 	case 1: /* Bound violation. */
 		info = mpx_generate_siginfo(regs, xsave_buf);
-		if (PTR_ERR(info)) {
+		if (IS_ERR(info)) {
 			/*
 			 * We failed to decode the MPX instruction.  Act as if
 			 * the exception was not caused by MPX.
maintainer Tested-by on v2 1/1
#1 lore raw
Quoted 12 lines · Dan Carpenter

We should be checking IS_ERR() here. PTR_ERR() is always true.

Fixes fe3d197f8431 ('x86, mpx: On-demand kernel allocation of bounds tables')

---
v2: Use correct fixes tag.

arch/x86/kernel/traps.c +0 -0
index 67d817e..f176d96 100644

arch/x86/kernel/traps.c dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) · line 337

Quoted 8 lines
arch/x86/kernel/traps.c +1 -1
@@ -331,7 +331,7 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)
 		break; /* Success, it was handled */
 	case 1: /* Bound violation. */
 		info = mpx_generate_siginfo(regs, xsave_buf);
-		if (PTR_ERR(info)) {
+		if (IS_ERR(info)) {
 			/*
 			 * We failed to decode the MPX instruction.  Act as if
 			 * the exception was not caused by MPX.

I checked that this works on real hardware. The si_addr field in the generated siginfo was empty without this patch applied. With this patch, it has good (looking at least) contents.

Thanks for catching this!

Tested-by on v2 1/1
#2 lore raw
In reply to Dan Carpenter

arch/x86/kernel/traps.c dotraplinkage void do_bounds(struct pt_regs >

Quoted 12 lines · Dan Carpenter

We should be checking IS_ERR() here. PTR_ERR() is always true.

Fixes fe3d197f8431 ('x86, mpx: On-demand kernel allocation of bounds

---
v2: Use correct fixes tag.

arch/x86/kernel/traps.c +0 -0
index 67d817e..f176d96 100644
@@ -331,7 +331,7 @@ dotraplinkage void do_bounds(struct pt_regs >  	

break; /* Success, it was handled */

arch/x86/kernel/traps.c dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) · line 337

Quoted 7 lines
arch/x86/kernel/traps.c +1 -1
 	case 1: /* Bound violation. */
 		info = mpx_generate_siginfo(regs, xsave_buf);
-		if (PTR_ERR(info)) {
+		if (IS_ERR(info)) {
 			/*
 			 * We failed to decode the MPX instruction.
 			 * the exception was not caused by MPX.

I checked that this works on real hardware. The si_addr field in the generated siginfo was empty without this patch applied. With this patch, it has good (looking at least) contents.

Thanks for catching this!

#3 lore raw

[tip:x86/mpx] x86_64/traps: Fix always true condition

In reply to Dan Carpenter
x86_64/traps: Fix always true condition
Commit-ID:  e10abb2f770eeb673d23c19980216b0fb62b4f50
Gitweb:     http://git.kernel.org/tip/e10abb2f770eeb673d23c19980216b0fb62b4f50
Author:     Dan Carpenter <[email protected]>
AuthorDate: Tue, 25 Nov 2014 20:21:14 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 8 Dec 2014 12:06:59 +0100

x86_64/traps: Fix always true condition

We should be checking IS_ERR() here. PTR_ERR() is always true.

Fixes fe3d197f8431 ('x86, mpx: On-demand kernel allocation of

bounds tables')

---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/traps.c +1 -1
index 651d5d4..f73fc4a 100644
@@ -323,7 +323,7 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)
 		break; /* Success, it was handled */
 	case 1: /* Bound violation. */
 		info = mpx_generate_siginfo(regs, xsave_buf);
-		if (PTR_ERR(info)) {
+		if (IS_ERR(info)) {
 			/*
 			 * We failed to decode the MPX instruction.  Act as if
 			 * the exception was not caused by MPX.