Commit 03ff1797 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Linus Torvalds

kernel/exit.c: Use list_for_each_entry(_safe) instead of list_for_each(_safe)

kernel/exit.c: Convert list_for_each(_safe) to
list_for_each_entry(_safe) in forget_original_parent(), exit_notify()
and do_wait()
Signed-off-by: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d4730127
...@@ -669,8 +669,7 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced) ...@@ -669,8 +669,7 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
static void static void
forget_original_parent(struct task_struct *father, struct list_head *to_release) forget_original_parent(struct task_struct *father, struct list_head *to_release)
{ {
struct task_struct *p, *reaper = father; struct task_struct *p, *n, *reaper = father;
struct list_head *_p, *_n;
do { do {
reaper = next_thread(reaper); reaper = next_thread(reaper);
...@@ -688,9 +687,8 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release) ...@@ -688,9 +687,8 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
* *
* Search them and reparent children. * Search them and reparent children.
*/ */
list_for_each_safe(_p, _n, &father->children) { list_for_each_entry_safe(p, n, &father->children, sibling) {
int ptrace; int ptrace;
p = list_entry(_p, struct task_struct, sibling);
ptrace = p->ptrace; ptrace = p->ptrace;
...@@ -718,8 +716,7 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release) ...@@ -718,8 +716,7 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
if (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && p->exit_signal == -1)) if (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && p->exit_signal == -1))
list_add(&p->ptrace_list, to_release); list_add(&p->ptrace_list, to_release);
} }
list_for_each_safe(_p, _n, &father->ptrace_children) { list_for_each_entry_safe(p, n, &father->ptrace_children, ptrace_list) {
p = list_entry(_p, struct task_struct, ptrace_list);
p->real_parent = reaper; p->real_parent = reaper;
reparent_thread(p, father, 1); reparent_thread(p, father, 1);
} }
...@@ -1518,12 +1515,9 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop, ...@@ -1518,12 +1515,9 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
tsk = current; tsk = current;
do { do {
struct task_struct *p; struct task_struct *p;
struct list_head *_p;
int ret; int ret;
list_for_each(_p,&tsk->children) { list_for_each_entry(p, &tsk->children, sibling) {
p = list_entry(_p, struct task_struct, sibling);
ret = eligible_child(pid, options, p); ret = eligible_child(pid, options, p);
if (!ret) if (!ret)
continue; continue;
...@@ -1605,9 +1599,8 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop, ...@@ -1605,9 +1599,8 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
} }
} }
if (!flag) { if (!flag) {
list_for_each(_p, &tsk->ptrace_children) { list_for_each_entry(p, &tsk->ptrace_children,
p = list_entry(_p, struct task_struct, ptrace_list) {
ptrace_list);
if (!eligible_child(pid, options, p)) if (!eligible_child(pid, options, p))
continue; continue;
flag = 1; flag = 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