All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch v2] x86_64, traps: always true condition
@ 2014-11-25 17:21 Dan Carpenter
  2014-12-04 21:33 ` Dave Hansen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2014-11-25 17:21 UTC (permalink / raw)
  To: kernel-janitors

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

Fixes: fe3d197f8431 ('x86, mpx: On-demand kernel allocation of bounds tables')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Use correct fixes tag.

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 67d817e..f176d96 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -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.

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

* Re: [patch v2] x86_64, traps: always true condition
  2014-11-25 17:21 [patch v2] x86_64, traps: always true condition Dan Carpenter
@ 2014-12-04 21:33 ` Dave Hansen
  2014-12-04 21:56 ` Dave Hansen
  2014-12-09 10:18 ` [tip:x86/mpx] x86_64/traps: Fix " tip-bot for Dan Carpenter
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Hansen @ 2014-12-04 21:33 UTC (permalink / raw)
  To: kernel-janitors

On 11/25/2014 09:21 AM, Dan Carpenter wrote:
> We should be checking IS_ERR() here.  PTR_ERR() is always true.
> 
> Fixes: fe3d197f8431 ('x86, mpx: On-demand kernel allocation of bounds tables')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: Use correct fixes tag.
> 
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index 67d817e..f176d96 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -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: Dave Hansen <dave.hansen@intel.com>


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

* Re: [patch v2] x86_64, traps: always true condition
  2014-11-25 17:21 [patch v2] x86_64, traps: always true condition Dan Carpenter
  2014-12-04 21:33 ` Dave Hansen
@ 2014-12-04 21:56 ` Dave Hansen
  2014-12-09 10:18 ` [tip:x86/mpx] x86_64/traps: Fix " tip-bot for Dan Carpenter
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Hansen @ 2014-12-04 21:56 UTC (permalink / raw)
  To: kernel-janitors

On 11/25/2014 09:21 AM, Dan Carpenter wrote:
> We should be checking IS_ERR() here.  PTR_ERR() is always true.
>
> Fixes: fe3d197f8431 ('x86, mpx: On-demand kernel allocation of bounds
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: Use correct fixes tag.
>
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index 67d817e..f176d96 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -331,7 +331,7 @@ dotraplinkage void do_bounds(struct pt_regs >  	
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.
>  			 * 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: Dave Hansen <dave.hansen@intel.com>



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

* [tip:x86/mpx] x86_64/traps: Fix always true condition
  2014-11-25 17:21 [patch v2] x86_64, traps: always true condition Dan Carpenter
  2014-12-04 21:33 ` Dave Hansen
  2014-12-04 21:56 ` Dave Hansen
@ 2014-12-09 10:18 ` tip-bot for Dan Carpenter
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Dan Carpenter @ 2014-12-09 10:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: oleg, tglx, luto, dan.carpenter, dave.hansen, mingo, hpa,
	masami.hiramatsu.pt, linux-kernel

Commit-ID:  e10abb2f770eeb673d23c19980216b0fb62b4f50
Gitweb:     http://git.kernel.org/tip/e10abb2f770eeb673d23c19980216b0fb62b4f50
Author:     Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Tue, 25 Nov 2014 20:21:14 +0300
Committer:  Ingo Molnar <mingo@kernel.org>
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')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Link: http://lkml.kernel.org/r/20141125172114.GA24535@mwanda
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 651d5d4..f73fc4a 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -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.

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

end of thread, other threads:[~2014-12-09 10:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-25 17:21 [patch v2] x86_64, traps: always true condition Dan Carpenter
2014-12-04 21:33 ` Dave Hansen
2014-12-04 21:56 ` Dave Hansen
2014-12-09 10:18 ` [tip:x86/mpx] x86_64/traps: Fix " tip-bot for Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.