]> git.hungrycats.org Git - linux/commitdiff
[PATCH] switch sys32_timer_create() to compat_alloc_user_space()
authorAlexander Viro <viro@www.linux.org.uk>
Fri, 16 Jul 2004 05:04:02 +0000 (22:04 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 16 Jul 2004 05:04:02 +0000 (22:04 -0700)
switched to compat_alloc_user_space(), cleaned up.

arch/x86_64/ia32/sys_ia32.c

index 6f76223996fb4d59b75defda5ec6d7bb6bdc9ec5..55541e9816f471504d93300ab37f0a840a0c1f9a 100644 (file)
@@ -1288,28 +1288,20 @@ sys_timer_create(clockid_t which_clock,
 long
 sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id)
 {
-       struct sigevent se;
-       mm_segment_t oldfs;
-       long err;
-
+       struct sigevent __user *p = NULL;
        if (se32) { 
+               struct sigevent se;
+               p = compat_alloc_user_space(sizeof(struct sigevent));
                memset(&se, 0, sizeof(struct sigevent)); 
                if (get_user(se.sigev_value.sival_int,  &se32->sigev_value) ||
                    __get_user(se.sigev_signo, &se32->sigev_signo) ||
                    __get_user(se.sigev_notify, &se32->sigev_notify) ||
                    __copy_from_user(&se._sigev_un._pad, &se32->payload, 
-                                    sizeof(se32->payload)))
+                                    sizeof(se32->payload)) ||
+                   copy_to_user(p, &se, sizeof(se)))
                        return -EFAULT;
        } 
-       if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t)))
-               return -EFAULT;
-
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_timer_create(clock, se32 ? &se : NULL, timer_id);
-       set_fs(oldfs); 
-       
-       return err; 
+       return sys_timer_create(clock, p, timer_id);
 } 
 
 long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high,