Bring syscall_set_return_value() in sync with syscall_get_error(), and let upcoming ptrace/set_syscall_info selftest pass on powerpc.
This reverts commit 1b1a3702a65c ("powerpc: Don't negate error in syscall_set_return_value()"). Signed-off-by: Dmitry V. Levin <l...@strace.io> --- arch/powerpc/include/asm/syscall.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h index 3dd36c5e334a..422d7735ace6 100644 --- a/arch/powerpc/include/asm/syscall.h +++ b/arch/powerpc/include/asm/syscall.h @@ -82,7 +82,11 @@ static inline void syscall_set_return_value(struct task_struct *task, */ if (error) { regs->ccr |= 0x10000000L; - regs->gpr[3] = error; + /* + * In case of an error regs->gpr[3] contains + * a positive ERRORCODE. + */ + regs->gpr[3] = -error; } else { regs->ccr &= ~0x10000000L; regs->gpr[3] = val; -- ldv