summaryrefslogtreecommitdiff
path: root/arch/arm64/include/asm/syscall.h
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2020-12-15 03:27:23 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2020-12-15 03:27:23 +0300
commit4b4193256c8d3bc3a5397b5cd9494c2ad386317d (patch)
treeb6b070f8893384b5d563fc616018e7d5644b2ece /arch/arm64/include/asm/syscall.h
parentcffdd6d90482316e18d686060a4397902ea04bd2 (diff)
parent92f0a3a22c7a4c936277ece3a0215955a2d52238 (diff)
downloadlinux-4b4193256c8d3bc3a5397b5cd9494c2ad386317d.tar.xz
Merge branch 'next' into for-linus
Prepare input updates for 5.11 merge window.
Diffstat (limited to 'arch/arm64/include/asm/syscall.h')
-rw-r--r--arch/arm64/include/asm/syscall.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index 65299a2dcf9c..cfc0672013f6 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -34,6 +34,10 @@ static inline long syscall_get_error(struct task_struct *task,
struct pt_regs *regs)
{
unsigned long error = regs->regs[0];
+
+ if (is_compat_thread(task_thread_info(task)))
+ error = sign_extend64(error, 31);
+
return IS_ERR_VALUE(error) ? error : 0;
}
@@ -47,7 +51,13 @@ static inline void syscall_set_return_value(struct task_struct *task,
struct pt_regs *regs,
int error, long val)
{
- regs->regs[0] = (long) error ? error : val;
+ if (error)
+ val = error;
+
+ if (is_compat_thread(task_thread_info(task)))
+ val = lower_32_bits(val);
+
+ regs->regs[0] = val;
}
#define SYSCALL_MAX_ARGS 6