[PATCH] exit.c: Fix Sparse errors and warnings
From: madhuparnabhowmik10
Date: Tue Jan 28 2020 - 12:20:20 EST
From: Madhuparna Bhowmik <madhuparnabhowmik10@xxxxxxxxx>
This patch fixes the following sparse error:
kernel/exit.c:627:25: error: incompatible types in comparison expression
caused due to accessing rcu protected pointer without using rcu primitives.
And the following warning:
kernel/exit.c:626:40: warning: incorrect type in assignment
Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@xxxxxxxxx>
---
kernel/exit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index bcbd59888e67..c5a9d6360440 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -623,8 +623,8 @@ static void forget_original_parent(struct task_struct *father,
reaper = find_new_reaper(father, reaper);
list_for_each_entry(p, &father->children, sibling) {
for_each_thread(p, t) {
- t->real_parent = reaper;
- BUG_ON((!t->ptrace) != (t->parent == father));
+ rcu_assign_pointer(t->real_parent, reaper);
+ BUG_ON((!t->ptrace) != (rcu_access_pointer(t->parent) == father));
if (likely(!t->ptrace))
t->parent = t->real_parent;
if (t->pdeath_signal)
--
2.17.1