Commit 0fe7d7f3 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

[PATCH] copy_thread(): unneeded child_tid initialization

{set,clear}_child_tid initialized in copy_process() right after return from
copy_thread().

These vars are not used in cleanup path if copy_thread() fails.

grep -r _child_tid arch/ shows only ia64/kernel/asm-offsets.c,
so i blindly patched non i386 archs too.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0963a84b
...@@ -122,8 +122,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -122,8 +122,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
*childregs = *regs; /* struct copy of pt_regs */ *childregs = *regs; /* struct copy of pt_regs */
p->set_child_tid = p->clear_child_tid = NULL;
childregs->r10 = 0; /* child returns 0 after a fork/clone */ childregs->r10 = 0; /* child returns 0 after a fork/clone */
/* put the switch stack right below the pt_regs */ /* put the switch stack right below the pt_regs */
......
...@@ -368,7 +368,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp, ...@@ -368,7 +368,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
*childregs = *regs; *childregs = *regs;
childregs->eax = 0; childregs->eax = 0;
childregs->esp = esp; childregs->esp = esp;
p->set_child_tid = p->clear_child_tid = NULL;
p->thread.esp = (unsigned long) childregs; p->thread.esp = (unsigned long) childregs;
p->thread.esp0 = (unsigned long) (childregs+1); p->thread.esp0 = (unsigned long) (childregs+1);
......
...@@ -247,8 +247,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long spu, ...@@ -247,8 +247,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long spu,
unsigned long sp = (unsigned long)tsk->thread_info + THREAD_SIZE; unsigned long sp = (unsigned long)tsk->thread_info + THREAD_SIZE;
extern void ret_from_fork(void); extern void ret_from_fork(void);
tsk->set_child_tid = tsk->clear_child_tid = NULL;
/* Copy registers */ /* Copy registers */
sp -= sizeof (struct pt_regs); sp -= sizeof (struct pt_regs);
childregs = (struct pt_regs *)sp; childregs = (struct pt_regs *)sp;
......
...@@ -140,7 +140,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -140,7 +140,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1); p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1);
childregs->cp0_status &= ~(ST0_CU2|ST0_CU1); childregs->cp0_status &= ~(ST0_CU2|ST0_CU1);
clear_tsk_thread_flag(p, TIF_USEDFPU); clear_tsk_thread_flag(p, TIF_USEDFPU);
p->set_child_tid = p->clear_child_tid = NULL;
return 0; return 0;
} }
......
...@@ -422,8 +422,6 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -422,8 +422,6 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE; unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
unsigned long childframe; unsigned long childframe;
p->set_child_tid = p->clear_child_tid = NULL;
CHECK_FULL_REGS(regs); CHECK_FULL_REGS(regs);
/* Copy registers */ /* Copy registers */
sp -= sizeof(struct pt_regs); sp -= sizeof(struct pt_regs);
......
...@@ -315,8 +315,6 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -315,8 +315,6 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
extern void ret_from_fork(void); extern void ret_from_fork(void);
unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE; unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
p->set_child_tid = p->clear_child_tid = NULL;
/* Copy registers */ /* Copy registers */
sp -= sizeof(struct pt_regs); sp -= sizeof(struct pt_regs);
childregs = (struct pt_regs *) sp; childregs = (struct pt_regs *) sp;
......
...@@ -238,7 +238,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp, ...@@ -238,7 +238,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
frame = ((struct fake_frame *) frame = ((struct fake_frame *)
(THREAD_SIZE + (unsigned long) p->thread_info)) - 1; (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
p->thread.ksp = (unsigned long) frame; p->thread.ksp = (unsigned long) frame;
p->set_child_tid = p->clear_child_tid = NULL;
/* Store access registers to kernel stack of new process. */ /* Store access registers to kernel stack of new process. */
frame->childregs = *regs; frame->childregs = *regs;
frame->childregs.gprs[2] = 0; /* child returns 0 on fork. */ frame->childregs.gprs[2] = 0; /* child returns 0 on fork. */
......
...@@ -306,7 +306,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -306,7 +306,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
childregs->gbr = childregs->regs[0]; childregs->gbr = childregs->regs[0];
} }
childregs->regs[0] = 0; /* Set return value for child */ childregs->regs[0] = 0; /* Set return value for child */
p->set_child_tid = p->clear_child_tid = NULL;
p->thread.sp = (unsigned long) childregs; p->thread.sp = (unsigned long) childregs;
p->thread.pc = (unsigned long) ret_from_fork; p->thread.pc = (unsigned long) ret_from_fork;
......
...@@ -765,9 +765,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -765,9 +765,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
childregs->regs[9] = 0; /* Set return value for child */ childregs->regs[9] = 0; /* Set return value for child */
childregs->sr |= SR_FD; /* Invalidate FPU flag */ childregs->sr |= SR_FD; /* Invalidate FPU flag */
/* From sh */
p->set_child_tid = p->clear_child_tid = NULL;
p->thread.sp = (unsigned long) childregs; p->thread.sp = (unsigned long) childregs;
p->thread.pc = (unsigned long) ret_from_fork; p->thread.pc = (unsigned long) ret_from_fork;
......
...@@ -480,8 +480,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -480,8 +480,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
#endif #endif
} }
p->set_child_tid = p->clear_child_tid = NULL;
/* /*
* p->thread_info new_stack childregs * p->thread_info new_stack childregs
* ! ! ! {if(PSR_PS) } * ! ! ! {if(PSR_PS) }
......
...@@ -621,8 +621,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, ...@@ -621,8 +621,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
p->thread.smp_lock_pc = 0; p->thread.smp_lock_pc = 0;
#endif #endif
p->set_child_tid = p->clear_child_tid = NULL;
/* Calculate offset to stack_frame & pt_regs */ /* Calculate offset to stack_frame & pt_regs */
child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ)); child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ));
memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ)); memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ));
......
...@@ -359,7 +359,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long rsp, ...@@ -359,7 +359,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long rsp,
if (rsp == ~0UL) { if (rsp == ~0UL) {
childregs->rsp = (unsigned long)childregs; childregs->rsp = (unsigned long)childregs;
} }
p->set_child_tid = p->clear_child_tid = NULL;
p->thread.rsp = (unsigned long) childregs; p->thread.rsp = (unsigned long) childregs;
p->thread.rsp0 = (unsigned long) (childregs+1); p->thread.rsp0 = (unsigned long) (childregs+1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment