Commit 5e937a9ae9137899c6641d718bd3820861099a09

Authored by Eric Paris
1 parent b7550787fe

syscall_get_arch: remove useless function arguments

Every caller of syscall_get_arch() uses current for the task and no
implementors of the function need args.  So just get rid of both of
those things.  Admittedly, since these are inline functions we aren't
wasting stack space, but it just makes the prototypes better.

Signed-off-by: Eric Paris <eparis@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mips@linux-mips.org
Cc: linux390@de.ibm.com
Cc: x86@kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: linux-arch@vger.kernel.org

Showing 7 changed files with 11 additions and 17 deletions Side-by-side Diff

arch/arm/include/asm/syscall.h
... ... @@ -103,8 +103,7 @@
103 103 memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0]));
104 104 }
105 105  
106   -static inline int syscall_get_arch(struct task_struct *task,
107   - struct pt_regs *regs)
  106 +static inline int syscall_get_arch(void)
108 107 {
109 108 /* ARM tasks don't change audit architectures on the fly. */
110 109 return AUDIT_ARCH_ARM;
arch/mips/include/asm/syscall.h
... ... @@ -101,7 +101,7 @@
101 101 extern const unsigned long sys32_call_table[];
102 102 extern const unsigned long sysn32_call_table[];
103 103  
104   -static inline int __syscall_get_arch(void)
  104 +static inline int syscall_get_arch(void)
105 105 {
106 106 int arch = EM_MIPS;
107 107 #ifdef CONFIG_64BIT
arch/mips/kernel/ptrace.c
... ... @@ -671,7 +671,7 @@
671 671 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
672 672 trace_sys_enter(regs, regs->regs[2]);
673 673  
674   - audit_syscall_entry(__syscall_get_arch(),
  674 + audit_syscall_entry(syscall_get_arch(),
675 675 regs->regs[2],
676 676 regs->regs[4], regs->regs[5],
677 677 regs->regs[6], regs->regs[7]);
arch/s390/include/asm/syscall.h
... ... @@ -89,11 +89,10 @@
89 89 regs->orig_gpr2 = args[0];
90 90 }
91 91  
92   -static inline int syscall_get_arch(struct task_struct *task,
93   - struct pt_regs *regs)
  92 +static inline int syscall_get_arch(void)
94 93 {
95 94 #ifdef CONFIG_COMPAT
96   - if (test_tsk_thread_flag(task, TIF_31BIT))
  95 + if (test_tsk_thread_flag(current, TIF_31BIT))
97 96 return AUDIT_ARCH_S390;
98 97 #endif
99 98 return sizeof(long) == 8 ? AUDIT_ARCH_S390X : AUDIT_ARCH_S390;
arch/x86/include/asm/syscall.h
... ... @@ -91,8 +91,7 @@
91 91 memcpy(&regs->bx + i, args, n * sizeof(args[0]));
92 92 }
93 93  
94   -static inline int syscall_get_arch(struct task_struct *task,
95   - struct pt_regs *regs)
  94 +static inline int syscall_get_arch(void)
96 95 {
97 96 return AUDIT_ARCH_I386;
98 97 }
... ... @@ -221,8 +220,7 @@
221 220 }
222 221 }
223 222  
224   -static inline int syscall_get_arch(struct task_struct *task,
225   - struct pt_regs *regs)
  223 +static inline int syscall_get_arch(void)
226 224 {
227 225 #ifdef CONFIG_IA32_EMULATION
228 226 /*
... ... @@ -234,7 +232,7 @@
234 232 *
235 233 * x32 tasks should be considered AUDIT_ARCH_X86_64.
236 234 */
237   - if (task_thread_info(task)->status & TS_COMPAT)
  235 + if (task_thread_info(current)->status & TS_COMPAT)
238 236 return AUDIT_ARCH_I386;
239 237 #endif
240 238 /* Both x32 and x86_64 are considered "64-bit". */
include/asm-generic/syscall.h
... ... @@ -144,8 +144,6 @@
144 144  
145 145 /**
146 146 * syscall_get_arch - return the AUDIT_ARCH for the current system call
147   - * @task: task of interest, must be in system call entry tracing
148   - * @regs: task_pt_regs() of @task
149 147 *
150 148 * Returns the AUDIT_ARCH_* based on the system call convention in use.
151 149 *
... ... @@ -155,6 +153,6 @@
155 153 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
156 154 * provide an implementation of this.
157 155 */
158   -int syscall_get_arch(struct task_struct *task, struct pt_regs *regs);
  156 +int syscall_get_arch(void);
159 157 #endif /* _ASM_SYSCALL_H */
... ... @@ -95,7 +95,7 @@
95 95 if (off == BPF_DATA(nr))
96 96 return syscall_get_nr(current, regs);
97 97 if (off == BPF_DATA(arch))
98   - return syscall_get_arch(current, regs);
  98 + return syscall_get_arch();
99 99 if (off >= BPF_DATA(args[0]) && off < BPF_DATA(args[6])) {
100 100 unsigned long value;
101 101 int arg = (off - BPF_DATA(args[0])) / sizeof(u64);
... ... @@ -351,7 +351,7 @@
351 351 info.si_code = SYS_SECCOMP;
352 352 info.si_call_addr = (void __user *)KSTK_EIP(current);
353 353 info.si_errno = reason;
354   - info.si_arch = syscall_get_arch(current, task_pt_regs(current));
  354 + info.si_arch = syscall_get_arch();
355 355 info.si_syscall = syscall;
356 356 force_sig_info(SIGSYS, &info, current);
357 357 }