sh: bring syscall_set_return_value in line with other architectures
authorMichael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Wed, 22 Jul 2020 23:13:22 +0000 (01:13 +0200)
committerRich Felker <dalias@libc.org>
Sat, 15 Aug 2020 02:05:20 +0000 (22:05 -0400)
Other architectures expect that syscall_set_return_value gets an already
negative value as error. That's also what kernel/seccomp.c provides.

Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Rich Felker <dalias@libc.org>
arch/sh/include/asm/syscall_32.h

index 0b5b8e7..cb51a75 100644 (file)
@@ -40,10 +40,7 @@ static inline void syscall_set_return_value(struct task_struct *task,
                                            struct pt_regs *regs,
                                            int error, long val)
 {
-       if (error)
-               regs->regs[0] = -error;
-       else
-               regs->regs[0] = val;
+       regs->regs[0] = (long) error ?: val;
 }
 
 static inline void syscall_get_arguments(struct task_struct *task,