aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/sys_sparc32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/sys_sparc32.c')
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c64
1 files changed, 2 insertions, 62 deletions
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 161ce4710fe7..ba5bd626b39e 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -236,13 +236,6 @@ asmlinkage long sys32_getegid16(void)
236 236
237/* 32-bit timeval and related flotsam. */ 237/* 32-bit timeval and related flotsam. */
238 238
239static long get_tv32(struct timeval *o, struct compat_timeval __user *i)
240{
241 return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
242 (__get_user(o->tv_sec, &i->tv_sec) |
243 __get_user(o->tv_usec, &i->tv_usec)));
244}
245
246static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i) 239static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
247{ 240{
248 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || 241 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
@@ -757,30 +750,6 @@ asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv,
757 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); 750 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
758} 751}
759 752
760asmlinkage long sys32_utimes(char __user *filename,
761 struct compat_timeval __user *tvs)
762{
763 struct timespec tv[2];
764
765 if (tvs) {
766 struct timeval ktvs[2];
767 if (get_tv32(&ktvs[0], tvs) ||
768 get_tv32(&ktvs[1], 1+tvs))
769 return -EFAULT;
770
771 if (ktvs[0].tv_usec < 0 || ktvs[0].tv_usec >= 1000000 ||
772 ktvs[1].tv_usec < 0 || ktvs[1].tv_usec >= 1000000)
773 return -EINVAL;
774
775 tv[0].tv_sec = ktvs[0].tv_sec;
776 tv[0].tv_nsec = 1000 * ktvs[0].tv_usec;
777 tv[1].tv_sec = ktvs[1].tv_sec;
778 tv[1].tv_nsec = 1000 * ktvs[1].tv_usec;
779 }
780
781 return do_utimes(AT_FDCWD, filename, tvs ? tv : NULL, 0);
782}
783
784/* These are here just in case some old sparc32 binary calls it. */ 753/* These are here just in case some old sparc32 binary calls it. */
785asmlinkage long sys32_pause(void) 754asmlinkage long sys32_pause(void)
786{ 755{
@@ -898,44 +867,15 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr,
898 unsigned long old_len, unsigned long new_len, 867 unsigned long old_len, unsigned long new_len,
899 unsigned long flags, u32 __new_addr) 868 unsigned long flags, u32 __new_addr)
900{ 869{
901 struct vm_area_struct *vma;
902 unsigned long ret = -EINVAL; 870 unsigned long ret = -EINVAL;
903 unsigned long new_addr = __new_addr; 871 unsigned long new_addr = __new_addr;
904 872
905 if (old_len > STACK_TOP32 || new_len > STACK_TOP32) 873 if (unlikely(sparc64_mmap_check(addr, old_len)))
906 goto out; 874 goto out;
907 if (addr > STACK_TOP32 - old_len) 875 if (unlikely(sparc64_mmap_check(new_addr, new_len)))
908 goto out; 876 goto out;
909 down_write(&current->mm->mmap_sem); 877 down_write(&current->mm->mmap_sem);
910 if (flags & MREMAP_FIXED) {
911 if (new_addr > STACK_TOP32 - new_len)
912 goto out_sem;
913 } else if (addr > STACK_TOP32 - new_len) {
914 unsigned long map_flags = 0;
915 struct file *file = NULL;
916
917 ret = -ENOMEM;
918 if (!(flags & MREMAP_MAYMOVE))
919 goto out_sem;
920
921 vma = find_vma(current->mm, addr);
922 if (vma) {
923 if (vma->vm_flags & VM_SHARED)
924 map_flags |= MAP_SHARED;
925 file = vma->vm_file;
926 }
927
928 /* MREMAP_FIXED checked above. */
929 new_addr = get_unmapped_area(file, addr, new_len,
930 vma ? vma->vm_pgoff : 0,
931 map_flags);
932 ret = new_addr;
933 if (new_addr & ~PAGE_MASK)
934 goto out_sem;
935 flags |= MREMAP_FIXED;
936 }
937 ret = do_mremap(addr, old_len, new_len, flags, new_addr); 878 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
938out_sem:
939 up_write(&current->mm->mmap_sem); 879 up_write(&current->mm->mmap_sem);
940out: 880out:
941 return ret; 881 return ret;