From nobody Mon Oct 6 01:26:46 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA5B180B for ; Mon, 28 Jul 2025 20:49:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753735785; cv=none; b=Jb/c8dM697gZIOX1p7gNXE9FhPugDBLErSGG29GjpD/1yzaLllkjj3PJNWEUGjCDPBg8wNbW9rblib1gY58k3q5lyFHTiSw1QyiiQf3VuzBLIawuPjHWn6MROabDtqY+etYPzAiX6zGc7jaUilVVR6ftt1RpQ1WgrDsHPFqjne8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753735785; c=relaxed/simple; bh=1h/ccd7mYSdeiigRgNASidHz3AmZ4bQvdOjtLEyasG4=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=DbbhCo8CcsNPZsZeFSW8Qi7EXWJnQc//RKJhRzP0hVhwGVieJTOqSKoGQgIV8UfB1kQd1u3na+g24aHOPO4phQlIRwoJ2LQsLfk5kxhVVnJ8Wbmjxk6xuuwg4T+qKxDy0OG62G3WKt+GkdbfdIzq7MUksmma65p2f0ZoDvmnDvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KN+udngU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KN+udngU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44C6CC4CEE7; Mon, 28 Jul 2025 20:49:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753735785; bh=1h/ccd7mYSdeiigRgNASidHz3AmZ4bQvdOjtLEyasG4=; h=Date:From:To:Cc:Subject:References:From; b=KN+udngUojK25D3ptPKH3/MdgUtOU4sQt0W21bBzkrYw0BQ8V6RMesxtGQJN4u8r3 041NDvyh7PiFqflI/Jnbjubkasy1buu8sikTI3fJmPkdb91OovAap/Ip0988oWG2UT bfnARZC4IZqZV+do6WdyNuJ3GvxguRRkAPpIZJWxj826BiB6rIl6ZIVv7FfCrpVU7U iEmXy9AHHO6ZkJZhzpnjD8BdE6Hxubxbkt/R/kJ26UWUrCZrsQgv/zFJOW6nqguuan wGe4Ggr1g6zxd2t2Bi/+iqfRlVrmA7lrXA1Rb79bplLAM6dIF+UN8Stdjkcg1XT+si Xok4aOXdyvs/Q== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ugUnG-000000042uJ-0KKb; Mon, 28 Jul 2025 16:49:58 -0400 Message-ID: <20250728204957.930076277@kernel.org> User-Agent: quilt/0.68 Date: Mon, 28 Jul 2025 16:49:35 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Masami Hiramatsu , Mathieu Desnoyers , Nam Cao , Gabriele Monaco Subject: [for-next][PATCH 01/11] rv: Fix wrong type cast in monitors_show() References: <20250728204934.281385756@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Nam Cao 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 Cc: Mathieu Desnoyers Link: https://lore.kernel.org/35e49e97696007919ceacf73796487a2e15a3d02.1753= 625621.git.namcao@linutronix.de Fixes: 24cbfe18d55a ("rv: Merge struct rv_monitor_def into struct rv_monito= r") Signed-off-by: Nam Cao Reviewed-by: Gabriele Monaco Signed-off-by: Steven Rostedt (Google) --- 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, s= truct rv_monitor *parent) */ static int monitors_show(struct seq_file *m, void *p) { - struct rv_monitor *mon =3D p; + struct rv_monitor *mon =3D container_of(p, struct rv_monitor, list); =20 if (mon->parent) seq_printf(m, "%s:%s\n", mon->parent->name, mon->name); --=20 2.47.2