linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Tomas Glozar <tglozar@redhat.com>, John Kacur <jkacur@redhat.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Nam Cao <namcao@linutronix.de>,
	Gabriele Monaco <gmonaco@redhat.com>
Subject: [for-next][PATCH 01/11] rv: Fix wrong type cast in monitors_show()
Date: Mon, 28 Jul 2025 16:49:35 -0400	[thread overview]
Message-ID: <20250728204957.930076277@kernel.org> (raw)
In-Reply-To: 20250728204934.281385756@kernel.org

From: Nam Cao <namcao@linutronix.de>

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>
---
 kernel/trace/rv/rv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 @@ static int create_monitor_dir(struct rv_monitor *mon, struct rv_monitor *parent)
  */
 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);
-- 
2.47.2



  reply	other threads:[~2025-07-28 20:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-28 20:49 [for-next][PATCH 00/11] verification: Updates for v6.17 Steven Rostedt
2025-07-28 20:49 ` Steven Rostedt [this message]
2025-07-28 20:49 ` [for-next][PATCH 02/11] rv: Fix wrong type cast in reactors_show() and monitor_reactor_show() Steven Rostedt
2025-07-28 20:49 ` [for-next][PATCH 03/11] rv: Add da_handle_start_run_event_ to per-task monitors Steven Rostedt
2025-07-28 20:49 ` [for-next][PATCH 04/11] rv: Remove trailing whitespace from tracepoint string Steven Rostedt
2025-07-28 20:49 ` [for-next][PATCH 05/11] rv: Use strings in da monitors tracepoints Steven Rostedt
2025-07-28 20:49 ` [for-next][PATCH 06/11] rv: Adjust monitor dependencies Steven Rostedt
2025-07-28 20:49 ` [for-next][PATCH 07/11] rv: Retry when da monitor detects race conditions Steven Rostedt
2025-07-28 20:49 ` [for-next][PATCH 08/11] sched: Adapt sched tracepoints for RV task model Steven Rostedt
2025-07-28 20:49 ` [for-next][PATCH 09/11] rv: Replace tss and sncid monitors with more complete sts Steven Rostedt
2025-07-28 20:49 ` [for-next][PATCH 10/11] rv: Add nrp and sssw per-task monitors Steven Rostedt
2025-07-28 20:49 ` [for-next][PATCH 11/11] rv: Add opid per-cpu monitor Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250728204957.930076277@kernel.org \
    --to=rostedt@kernel.org \
    --cc=gmonaco@redhat.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=namcao@linutronix.de \
    --cc=tglozar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).