rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exit.c: Fix Sparse errors and warnings
@ 2020-01-28 17:20 madhuparnabhowmik10
  2020-01-28 18:01 ` Christian Brauner
  2020-01-29 12:30 ` Oleg Nesterov
  0 siblings, 2 replies; 9+ messages in thread
From: madhuparnabhowmik10 @ 2020-01-28 17:20 UTC (permalink / raw)
  To: peterz, mingo, oleg, christian.brauner, paulmck
  Cc: linux-kernel, joel, linux-kernel-mentees, rcu, Madhuparna Bhowmik

From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] exit.c: Fix Sparse errors and warnings
@ 2020-01-30  6:20 madhuparnabhowmik10
  2020-01-30 10:31 ` Christian Brauner
  0 siblings, 1 reply; 9+ messages in thread
From: madhuparnabhowmik10 @ 2020-01-30  6:20 UTC (permalink / raw)
  To: peterz, mingo, oleg, christian.brauner, paulmck
  Cc: linux-kernel, joel, linux-kernel-mentees, rcu, Madhuparna Bhowmik

From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>

This patch fixes the following sparse error:
kernel/exit.c:627:25: error: incompatible types in comparison expression

And the following warning:
kernel/exit.c:626:40: warning: incorrect type in assignment

Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
---
 kernel/exit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index bcbd59888e67..daf827a4aa25 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_INIT_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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-01-30 15:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-28 17:20 [PATCH] exit.c: Fix Sparse errors and warnings madhuparnabhowmik10
2020-01-28 18:01 ` Christian Brauner
2020-01-29 12:30 ` Oleg Nesterov
2020-01-29 16:02   ` Madhuparna Bhowmik
2020-01-30  6:20 madhuparnabhowmik10
2020-01-30 10:31 ` Christian Brauner
2020-01-30 11:33   ` Oleg Nesterov
2020-01-30 11:45     ` Christian Brauner
2020-01-30 15:20       ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).