aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Chancellor <natechancellor@gmail.com>2019-08-11 23:31:17 -0400
committerPaul Burton <paul.burton@mips.com>2019-08-12 00:44:30 -0400
commit077ff3be06e8de2657075dd2738b9a21f8ebd890 (patch)
treedf6b697f8b914c2d0fea2ef567aa693db00557a8
parentc2869aafe7191d366d74c55cb8a93c6d0baba317 (diff)
MIPS/ptrace: Update mips_get_syscall_arg's return type
clang warns: arch/mips/include/asm/syscall.h:136:3: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized] ret |= mips_get_syscall_arg(args++, task, regs, i++); ^~~ arch/mips/include/asm/syscall.h:129:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 1 error generated. It's not wrong; however, it's not an issue in practice because ret is only assigned to, not read from. ret could just be initialized to zero but looking into it further, ret has been unused since it was first added in 2012 so just get rid of it and update mips_get_syscall_arg's return type since none of the return values are ever checked. If it is ever needed again, this commit can be reverted and ret can be properly initialized. Fixes: c0ff3c53d4f9 ("MIPS: Enable HAVE_ARCH_TRACEHOOK.") Link: https://github.com/ClangBuiltLinux/linux/issues/604 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: James Hogan <jhogan@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: clang-built-linux@googlegroups.com
-rw-r--r--arch/mips/include/asm/syscall.h21
1 files changed, 7 insertions, 14 deletions
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index 83bb439597d8..25fa651c937d 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -54,7 +54,7 @@ static inline void mips_syscall_update_nr(struct task_struct *task,
54 task_thread_info(task)->syscall = regs->regs[2]; 54 task_thread_info(task)->syscall = regs->regs[2];
55} 55}
56 56
57static inline unsigned long mips_get_syscall_arg(unsigned long *arg, 57static inline void mips_get_syscall_arg(unsigned long *arg,
58 struct task_struct *task, struct pt_regs *regs, unsigned int n) 58 struct task_struct *task, struct pt_regs *regs, unsigned int n)
59{ 59{
60 unsigned long usp __maybe_unused = regs->regs[29]; 60 unsigned long usp __maybe_unused = regs->regs[29];
@@ -63,23 +63,24 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
63 case 0: case 1: case 2: case 3: 63 case 0: case 1: case 2: case 3:
64 *arg = regs->regs[4 + n]; 64 *arg = regs->regs[4 + n];
65 65
66 return 0; 66 return;
67 67
68#ifdef CONFIG_32BIT 68#ifdef CONFIG_32BIT
69 case 4: case 5: case 6: case 7: 69 case 4: case 5: case 6: case 7:
70 return get_user(*arg, (int *)usp + n); 70 get_user(*arg, (int *)usp + n);
71 return;
71#endif 72#endif
72 73
73#ifdef CONFIG_64BIT 74#ifdef CONFIG_64BIT
74 case 4: case 5: case 6: case 7: 75 case 4: case 5: case 6: case 7:
75#ifdef CONFIG_MIPS32_O32 76#ifdef CONFIG_MIPS32_O32
76 if (test_tsk_thread_flag(task, TIF_32BIT_REGS)) 77 if (test_tsk_thread_flag(task, TIF_32BIT_REGS))
77 return get_user(*arg, (int *)usp + n); 78 get_user(*arg, (int *)usp + n);
78 else 79 else
79#endif 80#endif
80 *arg = regs->regs[4 + n]; 81 *arg = regs->regs[4 + n];
81 82
82 return 0; 83 return;
83#endif 84#endif
84 85
85 default: 86 default:
@@ -126,21 +127,13 @@ static inline void syscall_get_arguments(struct task_struct *task,
126{ 127{
127 unsigned int i = 0; 128 unsigned int i = 0;
128 unsigned int n = 6; 129 unsigned int n = 6;
129 int ret;
130 130
131 /* O32 ABI syscall() */ 131 /* O32 ABI syscall() */
132 if (mips_syscall_is_indirect(task, regs)) 132 if (mips_syscall_is_indirect(task, regs))
133 i++; 133 i++;
134 134
135 while (n--) 135 while (n--)
136 ret |= mips_get_syscall_arg(args++, task, regs, i++); 136 mips_get_syscall_arg(args++, task, regs, i++);
137
138 /*
139 * No way to communicate an error because this is a void function.
140 */
141#if 0
142 return ret;
143#endif
144} 137}
145 138
146extern const unsigned long sys_call_table[]; 139extern const unsigned long sys_call_table[];