Skip to content

Commit

Permalink
tracefs: Annotate tracefs_ops with __ro_after_init
Browse files Browse the repository at this point in the history
tracefs_ops is initialized inside tracefs_create_instance_dir and not
modified after. tracefs_create_instance_dir allows for initialization
only once, and is called from create_trace_instances(marked __init),
which is called from tracer_init_tracefs(marked __init). Also, mark
tracefs_create_instance_dir as __init.

Link: http://lkml.kernel.org/r/[email protected]

Reviewed-by: Kees Cook <[email protected]>
Signed-off-by: Zubin Mithra <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
  • Loading branch information
Zubin Mithra authored and rostedt committed Jul 31, 2018
1 parent c3bc8fd commit 5248ee8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/tracefs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static const struct file_operations tracefs_file_operations = {
static struct tracefs_dir_ops {
int (*mkdir)(const char *name);
int (*rmdir)(const char *name);
} tracefs_ops;
} tracefs_ops __ro_after_init;

static char *get_dname(struct dentry *dentry)
{
Expand Down Expand Up @@ -478,7 +478,8 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent)
*
* Returns the dentry of the instances directory.
*/
struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent,
__init struct dentry *tracefs_create_instance_dir(const char *name,
struct dentry *parent,
int (*mkdir)(const char *name),
int (*rmdir)(const char *name))
{
Expand Down

0 comments on commit 5248ee8

Please sign in to comment.