Skip to content

Commit fd0e685

Browse files
frextriterostedt
authored andcommitted
tracing: Annotate ftrace_graph_notrace_hash pointer with __rcu
Fix following instances of sparse error kernel/trace/ftrace.c:5667:29: error: incompatible types in comparison kernel/trace/ftrace.c:5813:21: error: incompatible types in comparison kernel/trace/ftrace.c:5868:36: error: incompatible types in comparison kernel/trace/ftrace.c:5870:25: error: incompatible types in comparison Use rcu_dereference_protected to dereference the newly annotated pointer. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Amol Grover <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 24a9729 commit fd0e685

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

kernel/trace/ftrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5592,7 +5592,7 @@ static const struct file_operations ftrace_notrace_fops = {
55925592
static DEFINE_MUTEX(graph_lock);
55935593

55945594
struct ftrace_hash __rcu *ftrace_graph_hash = EMPTY_HASH;
5595-
struct ftrace_hash *ftrace_graph_notrace_hash = EMPTY_HASH;
5595+
struct ftrace_hash __rcu *ftrace_graph_notrace_hash = EMPTY_HASH;
55965596

55975597
enum graph_filter_type {
55985598
GRAPH_FILTER_NOTRACE = 0,

kernel/trace/trace.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ extern void __trace_graph_return(struct trace_array *tr,
965965

966966
#ifdef CONFIG_DYNAMIC_FTRACE
967967
extern struct ftrace_hash __rcu *ftrace_graph_hash;
968-
extern struct ftrace_hash *ftrace_graph_notrace_hash;
968+
extern struct ftrace_hash __rcu *ftrace_graph_notrace_hash;
969969

970970
static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace)
971971
{
@@ -1018,10 +1018,14 @@ static inline void ftrace_graph_addr_finish(struct ftrace_graph_ret *trace)
10181018
static inline int ftrace_graph_notrace_addr(unsigned long addr)
10191019
{
10201020
int ret = 0;
1021+
struct ftrace_hash *notrace_hash;
10211022

10221023
preempt_disable_notrace();
10231024

1024-
if (ftrace_lookup_ip(ftrace_graph_notrace_hash, addr))
1025+
notrace_hash = rcu_dereference_protected(ftrace_graph_notrace_hash,
1026+
!preemptible());
1027+
1028+
if (ftrace_lookup_ip(notrace_hash, addr))
10251029
ret = 1;
10261030

10271031
preempt_enable_notrace();

0 commit comments

Comments
 (0)