[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131018083448.4d65ef78@gandalf.local.home>
Date: Fri, 18 Oct 2013 08:34:48 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Geyslan Gregório Bem <geyslan@...il.com>
Cc: kernel-br <kernel-br@...glegroups.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...hat.com>,
open list <linux-kernel@...r.kernel.org>,
Oleg Nesterov <oleg@...hat.com>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Subject: Re: [PATCH] tracing: fix referencing after memory freeing and
refactors code
On Fri, 18 Oct 2013 08:02:32 -0300
Geyslan Gregório Bem <geyslan@...il.com> wrote:
> >>
> >> I'm thinking of just nuking the tracing_open_generic() here. The only
> >> thing it does here is the tracing_disabled check. The assignment of
> >> inode->i_private to filp->private_data is pointless as it just
> >> reassigns it anyway.
> >>
> >> We could add a tracing_is_disabled() function to test instead.
> >
> > Nice, I can do it.
> >
> > Questions:
>
> I realized that here not:
Right, tracing_is_disabled() should not be called as a fops method.
> >
> > 1267 static const struct file_operations ftrace_enable_fops = {
> > 1268 .open = tracing_open_generic,
> > ...
> > 1286 static const struct file_operations ftrace_event_filter_fops = {
> > 1287 .open = tracing_open_generic,
> > ...
> > 1317 static const struct file_operations ftrace_show_header_fops = {
> > 1318 .open = tracing_open_generic,
>
> Tell me about this other case:
> >
> > Are that structures in same case? Their 'open' can be replaced to the
> > new 'tracing_is_disabled()?
> >
> > I think that 'subsystem_open()' can be also refactored to use the
> > about to rise 'tracing_is_disabled()'. Am I right?
> > 1096 ret = tracing_open_generic(inode, filp);
Hmm, no, it needs the assignment too. But perhaps we could just open
code it. The tracing_open_generic() is more for fops then to be a
helper for functions that don't use it for their .open routine.
Thus, for subsystem_open() you could have at the start:
if (tracing_is_disabled())
return -ENODEV;
Then have:
- ret = tracing_open_generic(inode, filp);
- if (ret < 0) {
- trace_array_put(tr);
- put_system(dir);
- }
+ filp->private_data = dir;
-- Steve
>
> Regards,
> -- Geyslan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists