Skip to contentSkip to conversation

copy_thread(): unneeded child_tid initialization

PATCH New Oleg Nesterov 1 participant 1 message Oct 2, 2004

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

PATCH 1/1 copy_thread(): unneeded child_tid initialization

Hello.

{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.

Oleg.

arch/cris/arch-v10/kernel/process.c +0 -2
diff -pur 2.6.9-rc3/arch/cris/arch-v10/kernel/process.c child_tid/arch/cris/arch-v10/kernel/process.c
@@ -122,8 +122,6 @@ int copy_thread(int nr, unsigned long cl
         
 	*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 */
 	
 	/* put the switch stack right below the pt_regs */
arch/i386/kernel/process.c +0 -1
diff -pur 2.6.9-rc3/arch/i386/kernel/process.c child_tid/arch/i386/kernel/process.c
@@ -368,7 +368,6 @@ int copy_thread(int nr, unsigned long cl
 	*childregs = *regs;
 	childregs->eax = 0;
 	childregs->esp = esp;
-	p->set_child_tid = p->clear_child_tid = NULL;
 
 	p->thread.esp = (unsigned long) childregs;
 	p->thread.esp0 = (unsigned long) (childregs+1);
arch/m32r/kernel/process.c +0 -2
diff -pur 2.6.9-rc3/arch/m32r/kernel/process.c child_tid/arch/m32r/kernel/process.c
@@ -247,8 +247,6 @@ int copy_thread(int nr, unsigned long cl
 	unsigned long sp = (unsigned long)tsk->thread_info + THREAD_SIZE;
 	extern void ret_from_fork(void);
 
-	tsk->set_child_tid = tsk->clear_child_tid = NULL;
-
 	/* Copy registers */
 	sp -= sizeof (struct pt_regs);
 	childregs = (struct pt_regs *)sp;
arch/mips/kernel/process.c +0 -1
diff -pur 2.6.9-rc3/arch/mips/kernel/process.c child_tid/arch/mips/kernel/process.c
@@ -140,7 +140,6 @@ int copy_thread(int nr, unsigned long cl
 	p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1);
 	childregs->cp0_status &= ~(ST0_CU2|ST0_CU1);
 	clear_tsk_thread_flag(p, TIF_USEDFPU);
-	p->set_child_tid = p->clear_child_tid = NULL;
 
 	return 0;
 }
arch/ppc/kernel/process.c +0 -2
diff -pur 2.6.9-rc3/arch/ppc/kernel/process.c child_tid/arch/ppc/kernel/process.c
@@ -422,8 +422,6 @@ copy_thread(int nr, unsigned long clone_
 	unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
 	unsigned long childframe;
 
-	p->set_child_tid = p->clear_child_tid = NULL;
-
 	CHECK_FULL_REGS(regs);
 	/* Copy registers */
 	sp -= sizeof(struct pt_regs);
arch/ppc64/kernel/process.c +0 -2
diff -pur 2.6.9-rc3/arch/ppc64/kernel/process.c child_tid/arch/ppc64/kernel/process.c
@@ -317,8 +317,6 @@ copy_thread(int nr, unsigned long clone_
 	extern void ret_from_fork(void);
 	unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
 
-	p->set_child_tid = p->clear_child_tid = NULL;
-
 	/* Copy registers */
 	sp -= sizeof(struct pt_regs);
 	childregs = (struct pt_regs *) sp;
arch/s390/kernel/process.c +0 -1
diff -pur 2.6.9-rc3/arch/s390/kernel/process.c child_tid/arch/s390/kernel/process.c
@@ -238,7 +238,6 @@ int copy_thread(int nr, unsigned long cl
         frame = ((struct fake_frame *)
 		 (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
         p->thread.ksp = (unsigned long) frame;
-	p->set_child_tid = p->clear_child_tid = NULL;
 	/* Store access registers to kernel stack of new process. */
         frame->childregs = *regs;
 	frame->childregs.gprs[2] = 0;	/* child returns 0 on fork. */
arch/sh/kernel/process.c +0 -1
diff -pur 2.6.9-rc3/arch/sh/kernel/process.c child_tid/arch/sh/kernel/process.c
@@ -306,7 +306,6 @@ int copy_thread(int nr, unsigned long cl
 		childregs->gbr = childregs->regs[0];
 	}
 	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.pc = (unsigned long) ret_from_fork;
arch/sh64/kernel/process.c +0 -3
diff -pur 2.6.9-rc3/arch/sh64/kernel/process.c child_tid/arch/sh64/kernel/process.c
@@ -765,9 +765,6 @@ int copy_thread(int nr, unsigned long cl
 	childregs->regs[9] = 0; /* Set return value for child */
 	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.pc = (unsigned long) ret_from_fork;
 
arch/sparc/kernel/process.c +0 -2
diff -pur 2.6.9-rc3/arch/sparc/kernel/process.c child_tid/arch/sparc/kernel/process.c
@@ -480,8 +480,6 @@ int copy_thread(int nr, unsigned long cl
 #endif
 	}
 
-	p->set_child_tid = p->clear_child_tid = NULL;
-
 	/*
 	 *  p->thread_info         new_stack   childregs
 	 *  !                      !           !             {if(PSR_PS) }
arch/sparc64/kernel/process.c +0 -2
diff -pur 2.6.9-rc3/arch/sparc64/kernel/process.c child_tid/arch/sparc64/kernel/process.c
@@ -621,8 +621,6 @@ int copy_thread(int nr, unsigned long cl
 	p->thread.smp_lock_pc = 0;
 #endif
 
-	p->set_child_tid = p->clear_child_tid = NULL;
-
 	/* Calculate offset to stack_frame & pt_regs */
 	child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ));
 	memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ));
arch/x86_64/kernel/process.c +0 -1
diff -pur 2.6.9-rc3/arch/x86_64/kernel/process.c child_tid/arch/x86_64/kernel/process.c
@@ -359,7 +359,6 @@ int copy_thread(int nr, unsigned long cl
 	if (rsp == ~0UL) {
 		childregs->rsp = (unsigned long)childregs;
 	}
-	p->set_child_tid = p->clear_child_tid = NULL;
 
 	p->thread.rsp = (unsigned long) childregs;
 	p->thread.rsp0 = (unsigned long) (childregs+1);