From nobody Mon Oct 6 01:26:45 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 3539322156C 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=1753735786; cv=none; b=gy+5qPf9XUBeD/wW9ZNJZcfE6WFuIgtrNHZuPbBQ+G54b2kczBX6y5o6XadBk6UO1EKDs+99vZYyTeWbDNlHxyZiFqDI4MLudZgtyUQ51q9X/e99e7TxzQkm8MXqERbxuAo9kNLRxZpUa2VXd3oGIowmDLeaARswLa389gz14pQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753735786; c=relaxed/simple; bh=xA9EdT2HycZIor0fvG3GFQWsXgKP+tp2pwkHaU1rJq8=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=EUnJB+BPEl8EPCGQ+WGDnANjPXPsB+vG1rXGshxGRme7tVv/jWZNb+FN3fgUF9vuNRujm0xkZzsfskejJqTgY+bX0fmPVYh2qjSOMguFNMiIblY9Qmg1z3otpRfILtK3urRG9sY2iDIDmKV2nws1hRj6uyacK0nl9cp9Yte8LDg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SbXcRV+w; 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="SbXcRV+w" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 742CBC4CEF7; 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=xA9EdT2HycZIor0fvG3GFQWsXgKP+tp2pwkHaU1rJq8=; h=Date:From:To:Cc:Subject:References:From; b=SbXcRV+w+ge8BFYBMXzAE52LvU1iAdz6wmURnebMTGoJLJtOnNUbrtKhIHS15eVIf qwI25zzAvU2Kmx8SUsUBp9WhAmWDWxIY43eTyTXWgV6lOjLiE1xCk+U0kTSKgoOOHW polqiTGPcn3W0MAlpuyzTBELlkK+OkF7frQ5djI8FReV+GyBnlTWKuO8/3zSXF14xW IG9a4jOJ8MWHBhCGDAvahyyJh2TmfeEy5A39z9sPTHs808K4NbpKadbjVbdqiTfWH7 uuQDXTyhdz/PC2b9/2HyY+rSwle0/eTQon8yVZzpVEQ4gTYT7AsP01mnT2KWoi/8Ui 3grON71lSGl6Q== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ugUnG-000000042up-12As; Mon, 28 Jul 2025 16:49:58 -0400 Message-ID: <20250728204958.099222690@kernel.org> User-Agent: quilt/0.68 Date: Mon, 28 Jul 2025 16:49:36 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Masami Hiramatsu , Mathieu Desnoyers , Gabriele Monaco , Nam Cao Subject: [for-next][PATCH 02/11] rv: Fix wrong type cast in reactors_show() and monitor_reactor_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 reactors_show() and monitor_reactor_show() is not a pointer to struct rv_reactor, it is actually a pointer to the list_head inside struct rv_reactor. Therefore it's wrong to cast 'p' to struct rv_reactor *. 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_reactor_def. This is no longer true since commit 3d3c376118b5 ("rv: Merge struct rv_reactor_def into struct rv_reactor") moved the list_head, and this wrong type cast became a functional problem. Properly use container_of() instead. Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Gabriele Monaco Link: https://lore.kernel.org/b4febbd6844311209e4c8768b65d508b81bd8c9b.1753= 625621.git.namcao@linutronix.de Fixes: 3d3c376118b5 ("rv: Merge struct rv_reactor_def into struct rv_reacto= r") Signed-off-by: Nam Cao Signed-off-by: Steven Rostedt (Google) --- kernel/trace/rv/rv_reactors.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/rv/rv_reactors.c b/kernel/trace/rv/rv_reactors.c index 106f2c4740f2..d32859fec238 100644 --- a/kernel/trace/rv/rv_reactors.c +++ b/kernel/trace/rv/rv_reactors.c @@ -86,7 +86,7 @@ static struct rv_reactor *get_reactor_rdef_by_name(char *= name) */ static int reactors_show(struct seq_file *m, void *p) { - struct rv_reactor *reactor =3D p; + struct rv_reactor *reactor =3D container_of(p, struct rv_reactor, list); =20 seq_printf(m, "%s\n", reactor->name); return 0; @@ -139,7 +139,7 @@ static const struct file_operations available_reactors_= ops =3D { static int monitor_reactor_show(struct seq_file *m, void *p) { struct rv_monitor *mon =3D m->private; - struct rv_reactor *reactor =3D p; + struct rv_reactor *reactor =3D container_of(p, struct rv_reactor, list); =20 if (mon->reactor =3D=3D reactor) seq_printf(m, "[%s]\n", reactor->name); --=20 2.47.2