Skip to contentSkip to conversation

Yama: mark local symbols as static

PATCH In review Jann Horn 3 participants 3 messages Mar 26, 2019 – Apr 10, 2019

Subsystems (2)
lore
Share & tools
lore

Jann Horn

author
#0 lore raw

PATCH 1/1 Yama: mark local symbols as static

sparse complains that Yama defines functions and a variable as non-static even though they don't exist in any header. Fix it by making them static.

---
 security/yama/yama_lsm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
security/yama/yama_lsm.c +3 -3
index 57cc60722dd3..06b14a57b0a4 100644
@@ -206,7 +206,7 @@ static void yama_ptracer_del(struct task_struct *tracer,
  * yama_task_free - check for task_pid to remove from exception list
  * @task: task being removed
  */
-void yama_task_free(struct task_struct *task)
+static void yama_task_free(struct task_struct *task)
 {
 	yama_ptracer_del(task, task);
 }
@@ -401,7 +401,7 @@ static int yama_ptrace_access_check(struct task_struct *child,
  *
  * Returns 0 if following the ptrace is allowed, -ve on error.
  */
-int yama_ptrace_traceme(struct task_struct *parent)
+static int yama_ptrace_traceme(struct task_struct *parent)
 {
 	int rc = 0;
 
@@ -452,7 +452,7 @@ static int yama_dointvec_minmax(struct ctl_table *table, int write,
 static int zero;
 static int max_scope = YAMA_SCOPE_NO_ATTACH;
 
-struct ctl_path yama_sysctl_path[] = {
+static struct ctl_path yama_sysctl_path[] = {
 	{ .procname = "kernel", },
 	{ .procname = "yama", },
 	{ }
Signature · 1 line
2.21.0.392.gf8f6787159e-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jann Horn

sparse complains that Yama defines functions and a variable as non-static even though they don't exist in any header. Fix it by making them static.

Quoted 35 lines
---
  security/yama/yama_lsm.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
security/yama/yama_lsm.c +3 -3
index 57cc60722dd3..06b14a57b0a4 100644
@@ -206,7 +206,7 @@ static void yama_ptracer_del(struct task_struct *tracer,
   * yama_task_free - check for task_pid to remove from exception list
   * @task: task being removed
   */
-void yama_task_free(struct task_struct *task)
+static void yama_task_free(struct task_struct *task)
  {
  	yama_ptracer_del(task, task);
  }
@@ -401,7 +401,7 @@ static int yama_ptrace_access_check(struct task_struct *child,
   *
   * Returns 0 if following the ptrace is allowed, -ve on error.
   */
-int yama_ptrace_traceme(struct task_struct *parent)
+static int yama_ptrace_traceme(struct task_struct *parent)
  {
  	int rc = 0;
 
@@ -452,7 +452,7 @@ static int yama_dointvec_minmax(struct ctl_table *table, int write,
  static int zero;
  static int max_scope = YAMA_SCOPE_NO_ATTACH;
 
-struct ctl_path yama_sysctl_path[] = {
+static struct ctl_path yama_sysctl_path[] = {
  	{ .procname = "kernel", },
  	{ .procname = "yama", },
  	{ }