2 * sparse/check_proc_create.c
4 * Copyright (C) 2010 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
18 {.name_param
= 0, .mode_param
= 1},
19 {.name_param
= 1, .mode_param
= 2},
24 static void match_create(const char *fn
, struct expression
*expr
, void *_param_type
)
26 struct expression
*arg_expr
;
29 int idx
= (int)_param_type
;
31 arg_expr
= get_argument_from_call_expr(expr
->args
, param_index
[idx
].mode_param
);
32 if (!get_implied_value(arg_expr
, &val
))
36 arg_expr
= get_argument_from_call_expr(expr
->args
, param_index
[idx
].name_param
);
37 name
= get_variable_from_expr(arg_expr
, NULL
);
38 sm_msg("warn: proc file '%s' is world writable", name
);
42 void check_proc_create(int id
)
45 if (option_project
!= PROJ_KERNEL
)
48 add_function_hook("proc_create", &match_create
, INT_PTR(0));
49 add_function_hook("create_proc_entry", &match_create
, INT_PTR(0));
50 add_function_hook("proc_create_data", &match_create
, INT_PTR(0));
51 add_function_hook("proc_net_fops_create", match_create
, INT_PTR(1));