summaryrefslogtreecommitdiff
path: root/kernel/trace/rv/rv.c
diff options
context:
space:
mode:
authorNam Cao <namcao@linutronix.de>2025-07-27 19:31:12 +0200
committerSteven Rostedt (Google) <rostedt@goodmis.org>2025-07-28 10:39:34 -0400
commite82aea50fe0600da176b2e50a6213f6057b719f9 (patch)
tree4fef38410d24939a55159e2bf40fe2bcf3d3a42e /kernel/trace/rv/rv.c
parentb8a7fba39cd49eab343bfe561d85bb5dc57541af (diff)
rv: Fix wrong type cast in monitors_show()
Argument 'p' of monitors_show() is not a pointer to struct rv_monitor, it is actually a pointer to the list_head inside struct rv_monitor. Therefore it is wrong to cast 'p' to struct rv_monitor *. This wrong type cast has been there since the beginning. But it still worked because the list_head was the first field in struct rv_monitor_def. This is no longer true since commit 24cbfe18d55a ("rv: Merge struct rv_monitor_def into struct rv_monitor") moved the list_head, and this wrong type cast became a functional problem. Properly use container_of() instead. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://lore.kernel.org/35e49e97696007919ceacf73796487a2e15a3d02.1753625621.git.namcao@linutronix.de Fixes: 24cbfe18d55a ("rv: Merge struct rv_monitor_def into struct rv_monitor") Signed-off-by: Nam Cao <namcao@linutronix.de> Reviewed-by: Gabriele Monaco <gmonaco@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/rv/rv.c')
-rw-r--r--kernel/trace/rv/rv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
index 6c8498743b98..bd7d56dbf6c2 100644
--- a/kernel/trace/rv/rv.c
+++ b/kernel/trace/rv/rv.c
@@ -458,7 +458,7 @@ out_remove_root:
*/
static int monitors_show(struct seq_file *m, void *p)
{
- struct rv_monitor *mon = p;
+ struct rv_monitor *mon = container_of(p, struct rv_monitor, list);
if (mon->parent)
seq_printf(m, "%s:%s\n", mon->parent->name, mon->name);