diff options
author | Adrian Huang <[email protected]> | 2020-12-17 13:26:48 +0800 |
---|---|---|
committer | Borislav Petkov <[email protected]> | 2021-01-05 19:07:42 +0100 |
commit | 91a8f6cb06b33adc79fbf5f7381d907485767c00 (patch) | |
tree | 95006acddbfcb9bbfd344de896f2da3e744df02a | |
parent | 3052636aa9aa2492ccac973449be63cae5b93a67 (diff) |
x86/mm: Refine mmap syscall implementation
It is unnecessary to use the local variable 'error' in the mmap syscall
implementation function - just return -EINVAL directly and get rid of
the local variable altogether.
[ bp: Massage commit message. ]
Signed-off-by: Adrian Huang <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
-rw-r--r-- | arch/x86/kernel/sys_x86_64.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c index 504fa5425bce..660b78827638 100644 --- a/arch/x86/kernel/sys_x86_64.c +++ b/arch/x86/kernel/sys_x86_64.c @@ -90,14 +90,10 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long, prot, unsigned long, flags, unsigned long, fd, unsigned long, off) { - long error; - error = -EINVAL; if (off & ~PAGE_MASK) - goto out; + return -EINVAL; - error = ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); -out: - return error; + return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); } static void find_start_end(unsigned long addr, unsigned long flags, |