[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220426102312.70319297@gandalf.local.home>
Date: Tue, 26 Apr 2022 10:23:12 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Jakob Koschel <jakobkoschel@...il.com>
Cc: Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Mike Rapoport <rppt@...nel.org>,
"Brian Johannesmeyer" <bjohannesmeyer@...il.com>,
Cristiano Giuffrida <c.giuffrida@...nl>,
"Bos, H.J." <h.j.bos@...nl>
Subject: Re: [PATCH v2 2/4] tracing: Remove usage of list iterator variable
after the loop
On Sat, 2 Apr 2022 12:33:39 +0200
Jakob Koschel <jakobkoschel@...il.com> wrote:
This patch crashed in my testing.
> @@ -1734,14 +1734,16 @@ static int subsystem_open(struct inode *inode, struct file *filp)
> /* Make sure the system still exists */
> mutex_lock(&event_mutex);
> mutex_lock(&trace_types_lock);
> - list_for_each_entry(tr, &ftrace_trace_arrays, list) {
> - list_for_each_entry(dir, &tr->systems, list) {
> - if (dir == inode->i_private) {
> + list_for_each_entry(iter_tr, &ftrace_trace_arrays, list) {
> + list_for_each_entry(iter_dir, &iter_tr->systems, list) {
> + if (iter_dir == inode->i_private) {
> /* Don't open systems with no events */
> - if (dir->nr_events) {
> + if (iter_dir->nr_events) {
> __get_system_dir(dir);
> system = dir->subsystem;
system = NULL->subsystem
> }
> + tr = iter_tr;
> + dir = iter_dir;
But do not change that dir, move the setting above it. That is:
tr = iter_tr;
dir = iter_dir;
if (iter_dir->nr_events) {
__get_system_dir(dir);
system = dir->subsystem;
}
-- Steve
> goto exit_loop;
> }
> }
Powered by blists - more mailing lists