| .. | .. |
|---|
| 9 | 9 | * |
|---|
| 10 | 10 | */ |
|---|
| 11 | 11 | |
|---|
| 12 | | - |
|---|
| 12 | +#include <linux/security.h> |
|---|
| 13 | 13 | #include <linux/list.h> |
|---|
| 14 | 14 | #include <linux/slab.h> |
|---|
| 15 | 15 | #include <linux/rbtree.h> |
|---|
| .. | .. |
|---|
| 72 | 72 | kfree(session); |
|---|
| 73 | 73 | } |
|---|
| 74 | 74 | |
|---|
| 75 | | -typedef int (*cmp_stat_t)(void *, void *); |
|---|
| 76 | | - |
|---|
| 77 | | -static int insert_stat(struct rb_root *root, void *stat, cmp_stat_t cmp) |
|---|
| 75 | +static int insert_stat(struct rb_root *root, void *stat, cmp_func_t cmp) |
|---|
| 78 | 76 | { |
|---|
| 79 | 77 | struct rb_node **new = &(root->rb_node), *parent = NULL; |
|---|
| 80 | 78 | struct stat_node *data; |
|---|
| .. | .. |
|---|
| 112 | 110 | * This one will force an insertion as right-most node |
|---|
| 113 | 111 | * in the rbtree. |
|---|
| 114 | 112 | */ |
|---|
| 115 | | -static int dummy_cmp(void *p1, void *p2) |
|---|
| 113 | +static int dummy_cmp(const void *p1, const void *p2) |
|---|
| 116 | 114 | { |
|---|
| 117 | 115 | return -1; |
|---|
| 118 | 116 | } |
|---|
| .. | .. |
|---|
| 238 | 236 | struct seq_file *m; |
|---|
| 239 | 237 | struct stat_session *session = inode->i_private; |
|---|
| 240 | 238 | |
|---|
| 239 | + ret = security_locked_down(LOCKDOWN_TRACEFS); |
|---|
| 240 | + if (ret) |
|---|
| 241 | + return ret; |
|---|
| 242 | + |
|---|
| 241 | 243 | ret = stat_seq_init(session); |
|---|
| 242 | 244 | if (ret) |
|---|
| 243 | 245 | return ret; |
|---|
| .. | .. |
|---|
| 274 | 276 | |
|---|
| 275 | 277 | static int tracing_stat_init(void) |
|---|
| 276 | 278 | { |
|---|
| 277 | | - struct dentry *d_tracing; |
|---|
| 279 | + int ret; |
|---|
| 278 | 280 | |
|---|
| 279 | | - d_tracing = tracing_init_dentry(); |
|---|
| 280 | | - if (IS_ERR(d_tracing)) |
|---|
| 281 | + ret = tracing_init_dentry(); |
|---|
| 282 | + if (ret) |
|---|
| 281 | 283 | return -ENODEV; |
|---|
| 282 | 284 | |
|---|
| 283 | | - stat_dir = tracefs_create_dir("trace_stat", d_tracing); |
|---|
| 285 | + stat_dir = tracefs_create_dir("trace_stat", NULL); |
|---|
| 284 | 286 | if (!stat_dir) { |
|---|
| 285 | 287 | pr_warn("Could not create tracefs 'trace_stat' entry\n"); |
|---|
| 286 | 288 | return -ENOMEM; |
|---|