2024-06-06 12:14:40

by Steven Rostedt

[permalink] [raw]
Subject: [for-next][PATCH 10/15] ftrace: Assign RCU list variable with rcu_assign_ptr()

From: "Steven Rostedt (Google)" <[email protected]>

Use rcu_assign_ptr() to assign the list pointer as it is marked as RCU,
and this quiets the sparse warning:

kernel/trace/ftrace.c:313:23: warning: incorrect type in assignment (different address spaces)
kernel/trace/ftrace.c:313:23: expected struct ftrace_ops [noderef] __rcu *
kernel/trace/ftrace.c:313:23: got struct ftrace_ops *

Link: https://lore.kernel.org/linux-trace-kernel/[email protected]

Cc: Mark Rutland <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Cc: Andrew Morton <[email protected]>
Acked-by: Masami Hiramatsu (Google) <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
---
kernel/trace/ftrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 034242675e7b..4aeb1183ea9f 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -311,7 +311,7 @@ static int remove_ftrace_ops(struct ftrace_ops __rcu **list,
lockdep_is_held(&ftrace_lock)) == ops &&
rcu_dereference_protected(ops->next,
lockdep_is_held(&ftrace_lock)) == &ftrace_list_end) {
- *list = &ftrace_list_end;
+ rcu_assign_pointer(*list, &ftrace_list_end);
return 0;
}

--
2.43.0