diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2013-02-14 12:44:23 -0500 |
---|---|---|
committer | Michael Ellerman <michael@ellerman.id.au> | 2013-04-17 23:03:57 -0400 |
commit | ee4a3916614829914830bc4371358f4d4a63c4d9 (patch) | |
tree | ba1c65ba0a58933b8d9d43fe0374bdbc775338ad /arch/powerpc/kernel/ptrace32.c | |
parent | 3cc33d50f52521760da29ebd9db239741da7f21a (diff) |
powerpc: fixing ptrace_get_reg to return an error
Currently ptrace_get_reg returns error as a value
what make impossible to tell whether it is a correct value or error code.
The patch adds a parameter which points to the real return data and
returns an error code.
As get_user_msr() never fails and it is used in multiple places so it has not
been changed by this patch.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel/ptrace32.c')
-rw-r--r-- | arch/powerpc/kernel/ptrace32.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c index c0244e766834..f51599e941c7 100644 --- a/arch/powerpc/kernel/ptrace32.c +++ b/arch/powerpc/kernel/ptrace32.c | |||
@@ -95,7 +95,9 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
95 | 95 | ||
96 | CHECK_FULL_REGS(child->thread.regs); | 96 | CHECK_FULL_REGS(child->thread.regs); |
97 | if (index < PT_FPR0) { | 97 | if (index < PT_FPR0) { |
98 | tmp = ptrace_get_reg(child, index); | 98 | ret = ptrace_get_reg(child, index, &tmp); |
99 | if (ret) | ||
100 | break; | ||
99 | } else { | 101 | } else { |
100 | flush_fp_to_thread(child); | 102 | flush_fp_to_thread(child); |
101 | /* | 103 | /* |
@@ -148,7 +150,11 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
148 | tmp = ((u64 *)child->thread.fpr) | 150 | tmp = ((u64 *)child->thread.fpr) |
149 | [FPRINDEX_3264(numReg)]; | 151 | [FPRINDEX_3264(numReg)]; |
150 | } else { /* register within PT_REGS struct */ | 152 | } else { /* register within PT_REGS struct */ |
151 | tmp = ptrace_get_reg(child, numReg); | 153 | unsigned long tmp2; |
154 | ret = ptrace_get_reg(child, numReg, &tmp2); | ||
155 | if (ret) | ||
156 | break; | ||
157 | tmp = tmp2; | ||
152 | } | 158 | } |
153 | reg32bits = ((u32*)&tmp)[part]; | 159 | reg32bits = ((u32*)&tmp)[part]; |
154 | ret = put_user(reg32bits, (u32 __user *)data); | 160 | ret = put_user(reg32bits, (u32 __user *)data); |
@@ -232,7 +238,10 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
232 | break; | 238 | break; |
233 | CHECK_FULL_REGS(child->thread.regs); | 239 | CHECK_FULL_REGS(child->thread.regs); |
234 | if (numReg < PT_FPR0) { | 240 | if (numReg < PT_FPR0) { |
235 | unsigned long freg = ptrace_get_reg(child, numReg); | 241 | unsigned long freg; |
242 | ret = ptrace_get_reg(child, numReg, &freg); | ||
243 | if (ret) | ||
244 | break; | ||
236 | if (index % 2) | 245 | if (index % 2) |
237 | freg = (freg & ~0xfffffffful) | (data & 0xfffffffful); | 246 | freg = (freg & ~0xfffffffful) | (data & 0xfffffffful); |
238 | else | 247 | else |