sparc: switch compat {f,}truncate64() to COMPAT_SYSCALL_DEFINE
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 20 Mar 2018 14:34:57 +0000 (10:34 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 20 Mar 2018 16:05:17 +0000 (12:05 -0400)
... and drop the pointless checks - sys_truncate() itself
might've lacked the check when that stuff was first written,
but it has already grown one by the time that stuff went into
mainline.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/sparc/kernel/sys_sparc32.c
arch/sparc/kernel/systbls.h
arch/sparc/kernel/systbls_64.S

index 50e9e4fdd8c6f0305e2cccc5ace9144b2bafc333..c27e7e9e641be864f810bf398a996a24363a1fe3 100644 (file)
 
 #include "systbls.h"
 
-asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
+COMPAT_SYSCALL_DEFINE3(truncate64, const char __user *, path, u32, high, u32, low)
 {
-       if ((int)high < 0)
-               return -EINVAL;
-       else
-               return sys_truncate(path, (high << 32) | low);
+       return sys_truncate(path, ((u64)high << 32) | low);
 }
 
-asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
+COMPAT_SYSCALL_DEFINE3(ftruncate64, unsigned int, fd, u32, high, u32, low)
 {
-       if ((int)high < 0)
-               return -EINVAL;
-       else
-               return sys_ftruncate(fd, (high << 32) | low);
+       return sys_ftruncate(fd, ((u64)high << 32) | low);
 }
 
 static int cp_compat_stat64(struct kstat *stat,
index 922c253ee086a58e6624fa58e89993ee36951704..1cb02fa28e9c63a764b224584e009e2216caeedb 100644 (file)
@@ -49,12 +49,12 @@ asmlinkage long sys_utrap_install(utrap_entry_t type,
 asmlinkage long sys_memory_ordering(unsigned long model);
 asmlinkage void sparc64_set_context(struct pt_regs *regs);
 asmlinkage void sparc64_get_context(struct pt_regs *regs);
-asmlinkage long sys32_truncate64(const char __user * path,
-                                unsigned long high,
-                                unsigned long low);
-asmlinkage long sys32_ftruncate64(unsigned int fd,
-                                 unsigned long high,
-                                 unsigned long low);
+asmlinkage long compat_sys_truncate64(const char __user * path,
+                                u32 high,
+                                u32 low);
+asmlinkage long compat_sys_ftruncate64(unsigned int fd,
+                                 u32 high,
+                                 u32 low);
 struct compat_stat64;
 asmlinkage long compat_sys_stat64(const char __user * filename,
                                  struct compat_stat64 __user *statbuf);
index 34dde99548b0fc828c0baeea34548ebb5f6dcbd3..387ef993880ae2b359955fd4c10d9c00907d55bd 100644 (file)
@@ -34,8 +34,8 @@ sys_call_table32:
 /*60*/ .word sys_umask, sys_chroot, compat_sys_newfstat, compat_sys_fstat64, sys_getpagesize
        .word sys_msync, sys_vfork, compat_sys_pread64, compat_sys_pwrite64, sys_geteuid
 /*70*/ .word sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect
-       .word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys_getgroups16
-/*80*/ .word sys_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, sys32_ftruncate64
+       .word sys_madvise, sys_vhangup, compat_sys_truncate64, sys_mincore, sys_getgroups16
+/*80*/ .word sys_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, compat_sys_ftruncate64
        .word sys_swapon, compat_sys_getitimer, sys_setuid, sys_sethostname, sys_setgid
 /*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, compat_sys_select, sys_setfsgid
        .word sys_fsync, sys_setpriority, sys_socket, sys_connect, sys_accept