Commit 333306d0 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] switch sys32_timer_create() to compat_alloc_user_space()

switched to compat_alloc_user_space(), cleaned up.
parent 8a470649
...@@ -1288,28 +1288,20 @@ sys_timer_create(clockid_t which_clock, ...@@ -1288,28 +1288,20 @@ sys_timer_create(clockid_t which_clock,
long long
sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id) sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id)
{ {
struct sigevent se; struct sigevent __user *p = NULL;
mm_segment_t oldfs;
long err;
if (se32) { if (se32) {
struct sigevent se;
p = compat_alloc_user_space(sizeof(struct sigevent));
memset(&se, 0, sizeof(struct sigevent)); memset(&se, 0, sizeof(struct sigevent));
if (get_user(se.sigev_value.sival_int, &se32->sigev_value) || if (get_user(se.sigev_value.sival_int, &se32->sigev_value) ||
__get_user(se.sigev_signo, &se32->sigev_signo) || __get_user(se.sigev_signo, &se32->sigev_signo) ||
__get_user(se.sigev_notify, &se32->sigev_notify) || __get_user(se.sigev_notify, &se32->sigev_notify) ||
__copy_from_user(&se._sigev_un._pad, &se32->payload, __copy_from_user(&se._sigev_un._pad, &se32->payload,
sizeof(se32->payload))) sizeof(se32->payload)) ||
copy_to_user(p, &se, sizeof(se)))
return -EFAULT; return -EFAULT;
} }
if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t))) return sys_timer_create(clock, p, timer_id);
return -EFAULT;
oldfs = get_fs();
set_fs(KERNEL_DS);
err = sys_timer_create(clock, se32 ? &se : NULL, timer_id);
set_fs(oldfs);
return err;
} }
long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment