public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] x86, dumpstack: removed unneeded check in dump_trace()
@ 2012-01-28 10:52 Dan Carpenter
  2012-01-28 11:00 ` Frederic Weisbecker
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-01-28 10:52 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Ingo Molnar, H. Peter Anvin, x86, Frederic Weisbecker,
	Namhyung Kim, Peter Zijlstra, Clemens Ladisch, linux-kernel,
	kernel-janitors

Smatch complains that we have some inconsistent NULL checking.  If
"task" were NULL then it would lead to a NULL dereference later.  We
can remove this test because earlier on in the function we have:
	if (!task)
		task = current;

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 6d728d9..af7785f 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -129,7 +129,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
 	if (!stack) {
 		if (regs)
 			stack = (unsigned long *)regs->sp;
-		else if (task && task != current)
+		else if (task != current)
 			stack = (unsigned long *)task->thread.sp;
 		else
 			stack = &dummy;

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

* Re: [patch] x86, dumpstack: removed unneeded check in dump_trace()
  2012-01-28 10:52 [patch] x86, dumpstack: removed unneeded check in dump_trace() Dan Carpenter
@ 2012-01-28 11:00 ` Frederic Weisbecker
  0 siblings, 0 replies; 2+ messages in thread
From: Frederic Weisbecker @ 2012-01-28 11:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Namhyung Kim,
	Peter Zijlstra, Clemens Ladisch, linux-kernel, kernel-janitors

On Sat, Jan 28, 2012 at 01:52:46PM +0300, Dan Carpenter wrote:
> Smatch complains that we have some inconsistent NULL checking.  If
> "task" were NULL then it would lead to a NULL dereference later.  We
> can remove this test because earlier on in the function we have:
> 	if (!task)
> 		task = current;
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Frederic Weisbecker <fweisbec@gmail.com>

> 
> diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
> index 6d728d9..af7785f 100644
> --- a/arch/x86/kernel/dumpstack_64.c
> +++ b/arch/x86/kernel/dumpstack_64.c
> @@ -129,7 +129,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
>  	if (!stack) {
>  		if (regs)
>  			stack = (unsigned long *)regs->sp;
> -		else if (task && task != current)
> +		else if (task != current)
>  			stack = (unsigned long *)task->thread.sp;
>  		else
>  			stack = &dummy;

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

end of thread, other threads:[~2012-01-28 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-28 10:52 [patch] x86, dumpstack: removed unneeded check in dump_trace() Dan Carpenter
2012-01-28 11:00 ` Frederic Weisbecker

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