tracefs: Annotate tracefs_ops with __ro_after_init

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/20180725171901.4468-1-zsm@chromium.org

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Zubin Mithra <zsm@chromium.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
Zubin Mithra 2018-07-25 10:19:01 -07:00 коммит произвёл Steven Rostedt (VMware)
Родитель c3bc8fd637
Коммит 5248ee8560
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -53,7 +53,7 @@ static const struct file_operations tracefs_file_operations = {
static struct tracefs_dir_ops { static struct tracefs_dir_ops {
int (*mkdir)(const char *name); int (*mkdir)(const char *name);
int (*rmdir)(const char *name); int (*rmdir)(const char *name);
} tracefs_ops; } tracefs_ops __ro_after_init;
static char *get_dname(struct dentry *dentry) static char *get_dname(struct dentry *dentry)
{ {
@ -478,7 +478,8 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent)
* *
* Returns the dentry of the instances directory. * 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 (*mkdir)(const char *name),
int (*rmdir)(const char *name)) int (*rmdir)(const char *name))
{ {