Skip to contentSkip to conversation

x86, dumpstack: removed unneeded check in dump_trace()

PATCH In review Dan Carpenter 2 participants 3 messages Jan 28, 2012 – Jan 30, 2012

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

PATCH 1/1 x86, dumpstack: removed unneeded check in dump_trace()

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;
arch/x86/kernel/dumpstack_64.c +1 -1
index 6d728d9..af7785f 100644
@@ -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;
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Dan Carpenter

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;
Quoted 14 lines
arch/x86/kernel/dumpstack_64.c +1 -1
index 6d728d9..af7785f 100644
@@ -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;
#2 lore raw

[tip:perf/urgent] x86/dumpstack: Remove unneeded check in dump_trace()

In reply to Dan Carpenter
Commit-ID:  d0caf292505d051b1026e85faf3a85e907566f31
Gitweb:     http://git.kernel.org/tip/d0caf292505d051b1026e85faf3a85e907566f31
Author:     Dan Carpenter <[email protected]>
AuthorDate: Sat, 28 Jan 2012 13:52:46 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sat, 28 Jan 2012 13:09:06 +0100

x86/dumpstack: Remove unneeded check in dump_trace()

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;
---
 arch/x86/kernel/dumpstack_64.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/dumpstack_64.c +1 -1
index 6d728d9..af7785f 100644
@@ -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;