mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i386: Remove unneeded test of 'task' in dump_trace() (again)
@ 2014-03-07 15:52 Steven Rostedt
  2014-03-07 17:21 ` Alexander van Heukelum
  2014-03-11 12:39 ` [tip:x86/debug] " tip-bot for Steven Rostedt
  0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2014-03-07 15:52 UTC (permalink / raw)
  To: LKML
  Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Dan Carpenter,
	Jesper Juhl, Alexander van Heukelum


Commit 028a690a1ebc8b "i386: Remove unneeded test of 'task' in dump_trace()"
correctly removed the unneeded 'task != NULL' check because it would
be set to current if it was NULL.

Commit 2bc5f927d489 "i386: split out dumpstack code from traps_32.c"
moved the code from traps_32.c to its own file dump_stack.c for
preparation of the i386 / x86_64 merge.

Commit 8a541665b906 "dumpstack: x86: various small unification steps"
worked to make i386 and x86_64 dump_stack logic similar. But this
actually reverted the correct change from 028a690a1ebc8b.

Commit d0caf292505d "x86/dumpstack: Remove unneeded check in dump_trace()"
removed the unneeded "task != NULL" check for x86_64 but left that same
unneeded check for i386, that was added because x86_64 had it!

This chain of events ironically had i386 add back the unneeded task != NULL
check because x86_64 did it, and then the fix for x86_64 was fixed
by Dan. And even more ironically, it was Dan's smatch bot that told
me that a change to dump_stack_32 I made may be wrong if current can
be NULL (it can't), as there was a check for it by assigning task to
current, and then checking if task is NULL.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/kernel/dumpstack_32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index dca820b..5abd4cd 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -53,7 +53,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
 		unsigned long dummy;
 
 		stack = &dummy;
-		if (task && task != current)
+		if (task != current)
 			stack = (unsigned long *)task->thread.sp;
 	}
 
-- 
1.8.1.4


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

* Re: [PATCH] i386: Remove unneeded test of 'task' in dump_trace() (again)
  2014-03-07 15:52 [PATCH] i386: Remove unneeded test of 'task' in dump_trace() (again) Steven Rostedt
@ 2014-03-07 17:21 ` Alexander van Heukelum
  2014-03-11 12:39 ` [tip:x86/debug] " tip-bot for Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander van Heukelum @ 2014-03-07 17:21 UTC (permalink / raw)
  To: Steven Rostedt, LKML
  Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Dan Carpenter, Jesper Juhl

On Fri, Mar 7, 2014, at 16:52, Steven Rostedt wrote:
> 
> Commit 028a690a1ebc8b "i386: Remove unneeded test of 'task' in dump_trace()"
> correctly removed the unneeded 'task != NULL' check because it would
> be set to current if it was NULL.
> 
> Commit 2bc5f927d489 "i386: split out dumpstack code from traps_32.c"
> moved the code from traps_32.c to its own file dump_stack.c for
> preparation of the i386 / x86_64 merge.
> 
> Commit 8a541665b906 "dumpstack: x86: various small unification steps"
> worked to make i386 and x86_64 dump_stack logic similar. But this
> actually reverted the correct change from 028a690a1ebc8b.
> 
> Commit d0caf292505d "x86/dumpstack: Remove unneeded check in dump_trace()"
> removed the unneeded "task != NULL" check for x86_64 but left that same
> unneeded check for i386, that was added because x86_64 had it!
> 
> This chain of events ironically had i386 add back the unneeded task != NULL
> check because x86_64 did it, and then the fix for x86_64 was fixed
> by Dan. And even more ironically, it was Dan's smatch bot that told
> me that a change to dump_stack_32 I made may be wrong if current can
> be NULL (it can't), as there was a check for it by assigning task to
> current, and then checking if task is NULL.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Jesper Juhl <jesper.juhl@gmail.com>
> Cc: Alexander van Heukelum <heukelum@fastmail.fm>

Great archeology ;)

Acked-by: Alexander van Heukelum <heukelum@fastmail.fm>

> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  arch/x86/kernel/dumpstack_32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
> index dca820b..5abd4cd 100644
> --- a/arch/x86/kernel/dumpstack_32.c
> +++ b/arch/x86/kernel/dumpstack_32.c
> @@ -53,7 +53,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
>  		unsigned long dummy;
>  
>  		stack = &dummy;
> -		if (task && task != current)
> +		if (task != current)
>  			stack = (unsigned long *)task->thread.sp;
>  	}
>  
> -- 
> 1.8.1.4
> 

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

* [tip:x86/debug] i386: Remove unneeded test of 'task' in dump_trace() (again)
  2014-03-07 15:52 [PATCH] i386: Remove unneeded test of 'task' in dump_trace() (again) Steven Rostedt
  2014-03-07 17:21 ` Alexander van Heukelum
@ 2014-03-11 12:39 ` tip-bot for Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Steven Rostedt @ 2014-03-11 12:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, heukelum, jesper.juhl, rostedt, tglx,
	dan.carpenter

Commit-ID:  7743a536beda6225eef4a0758c5370f761fb0616
Gitweb:     http://git.kernel.org/tip/7743a536beda6225eef4a0758c5370f761fb0616
Author:     Steven Rostedt <rostedt@goodmis.org>
AuthorDate: Fri, 7 Mar 2014 10:52:42 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 11 Mar 2014 12:02:31 +0100

i386: Remove unneeded test of 'task' in dump_trace() (again)

Commit 028a690a1ebc8b "i386: Remove unneeded test of 'task' in
dump_trace()" correctly removed the unneeded 'task != NULL'
check because it would be set to current if it was NULL.

Commit 2bc5f927d489 "i386: split out dumpstack code from
traps_32.c" moved the code from traps_32.c to its own file
dump_stack.c for preparation of the i386 / x86_64 merge.

Commit 8a541665b906 "dumpstack: x86: various small unification
steps" worked to make i386 and x86_64 dump_stack logic similar.
But this actually reverted the correct change from
028a690a1ebc8b.

Commit d0caf292505d "x86/dumpstack: Remove unneeded check in
dump_trace()" removed the unneeded "task != NULL" check for
x86_64 but left that same unneeded check for i386, that was
added because x86_64 had it!

This chain of events ironically had i386 add back the unneeded
task != NULL check because x86_64 did it, and then the fix for
x86_64 was fixed by Dan. And even more ironically, it was Dan's
smatch bot that told me that a change to dump_stack_32 I made
may be wrong if current can be NULL (it can't), as there was a
check for it by assigning task to current, and then checking if
task is NULL.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Alexander van Heukelum <heukelum@fastmail.fm>
Cc: Jesper Juhl <jesper.juhl@gmail.com>
Link: http://lkml.kernel.org/r/20140307105242.79a0befd@gandalf.local.home
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/dumpstack_32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index f2a1770..a21d49c 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -30,7 +30,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
 		unsigned long dummy;
 
 		stack = &dummy;
-		if (task && task != current)
+		if (task != current)
 			stack = (unsigned long *)task->thread.sp;
 	}
 

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

end of thread, other threads:[~2014-03-11 12:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-07 15:52 [PATCH] i386: Remove unneeded test of 'task' in dump_trace() (again) Steven Rostedt
2014-03-07 17:21 ` Alexander van Heukelum
2014-03-11 12:39 ` [tip:x86/debug] " tip-bot for Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome