Messages in this thread | | | Date | Tue, 26 Apr 2022 10:23:12 -0400 | From | Steven Rostedt <> | 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@gmail.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; > } > }
| |