Skip to contentSkip to conversation

mm: remove unnecessary check in alloc_thread_stack_node()

PATCH In review Dan Carpenter 2 participants 3 messages Mar 1, 2022

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

PATCH 1/1 mm: remove unnecessary check in alloc_thread_stack_node()

The "stack" pointer cannot be NULL at this point so there is no need to check.

---
 kernel/fork.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/fork.c +1 -2
index 516f9db66640..5e7ca394b8e3 100644
@@ -327,8 +327,7 @@ static int alloc_thread_stack_node(struct task_struct *tsk, int node)
 	 * so cache the vm_struct.
 	 */
 	tsk->stack_vm_area = vm;
-	if (stack)
-		stack = kasan_reset_tag(stack);
+	stack = kasan_reset_tag(stack);
 	tsk->stack = stack;
 	return 0;
 }
Signature · 1 line
2.20.1
#2 lore raw
Quoted 7 lines · Sebastian Andrzej Siewior
Quoted 4 lines · Dan Carpenter

The "stack" pointer cannot be NULL at this point so there is no need to check.

Which tree is this against? Could you try against -tip, please?

This was against linux-next. The patch needs to go through Andrew's tree, not through -tip.

I should have included a fixes tag so Andrew will know which patch to fold with.

Fixes dbcd55bd6681 ("kasan, fork: reset pointer tags of vmapped stacks")

regards,
dan carpenter