lkml.org 
[lkml]   [2013]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] tracing: fix referencing after memory freeing and refactors code
On Fri, 18 Oct 2013 08:02:32 -0300
Geyslan Gregório Bem <geyslan@gmail.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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2013-10-18 16:21    [W:0.104 / U:3.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site