lkml.org 
[lkml]   [2020]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] events: callchain: Use RCU API to access RCU pointer
Date
callchain_cpus_entries is annotated as an RCU pointer.
Hence rcu_dereference_protected or similar RCU API is
required to dereference the pointer.

This fixes the following sparse warning
kernel/events/callchain.c:65:17: warning: incorrect type in assignment

Signed-off-by: Amol Grover <frextrite@gmail.com>
---
kernel/events/callchain.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c
index f91e1f41d25d..a672d02a1b3a 100644
--- a/kernel/events/callchain.c
+++ b/kernel/events/callchain.c
@@ -62,7 +62,8 @@ static void release_callchain_buffers(void)
{
struct callchain_cpus_entries *entries;

- entries = callchain_cpus_entries;
+ entries = rcu_dereference_protected(callchain_cpus_entries,
+ lockdep_is_held(&callchain_mutex));
RCU_INIT_POINTER(callchain_cpus_entries, NULL);
call_rcu(&entries->rcu_head, release_callchain_buffers_rcu);
}
--
2.24.1
\
 
 \ /
  Last update: 2020-01-29 17:10    [W:2.610 / U:1.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site