Commit 7668b679 authored by Al Viro's avatar Al Viro

put_compat_rusage(): switch to copy_to_user()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 8f13621a
...@@ -406,25 +406,27 @@ COMPAT_SYSCALL_DEFINE3(sigprocmask, int, how, ...@@ -406,25 +406,27 @@ COMPAT_SYSCALL_DEFINE3(sigprocmask, int, how,
int put_compat_rusage(const struct rusage *r, struct compat_rusage __user *ru) int put_compat_rusage(const struct rusage *r, struct compat_rusage __user *ru)
{ {
if (!access_ok(VERIFY_WRITE, ru, sizeof(*ru)) || struct compat_rusage r32;
__put_user(r->ru_utime.tv_sec, &ru->ru_utime.tv_sec) || memset(&r32, 0, sizeof(r32));
__put_user(r->ru_utime.tv_usec, &ru->ru_utime.tv_usec) || r32.ru_utime.tv_sec = r->ru_utime.tv_sec;
__put_user(r->ru_stime.tv_sec, &ru->ru_stime.tv_sec) || r32.ru_utime.tv_usec = r->ru_utime.tv_usec;
__put_user(r->ru_stime.tv_usec, &ru->ru_stime.tv_usec) || r32.ru_stime.tv_sec = r->ru_stime.tv_sec;
__put_user(r->ru_maxrss, &ru->ru_maxrss) || r32.ru_stime.tv_usec = r->ru_stime.tv_usec;
__put_user(r->ru_ixrss, &ru->ru_ixrss) || r32.ru_maxrss = r->ru_maxrss;
__put_user(r->ru_idrss, &ru->ru_idrss) || r32.ru_ixrss = r->ru_ixrss;
__put_user(r->ru_isrss, &ru->ru_isrss) || r32.ru_idrss = r->ru_idrss;
__put_user(r->ru_minflt, &ru->ru_minflt) || r32.ru_isrss = r->ru_isrss;
__put_user(r->ru_majflt, &ru->ru_majflt) || r32.ru_minflt = r->ru_minflt;
__put_user(r->ru_nswap, &ru->ru_nswap) || r32.ru_majflt = r->ru_majflt;
__put_user(r->ru_inblock, &ru->ru_inblock) || r32.ru_nswap = r->ru_nswap;
__put_user(r->ru_oublock, &ru->ru_oublock) || r32.ru_inblock = r->ru_inblock;
__put_user(r->ru_msgsnd, &ru->ru_msgsnd) || r32.ru_oublock = r->ru_oublock;
__put_user(r->ru_msgrcv, &ru->ru_msgrcv) || r32.ru_msgsnd = r->ru_msgsnd;
__put_user(r->ru_nsignals, &ru->ru_nsignals) || r32.ru_msgrcv = r->ru_msgrcv;
__put_user(r->ru_nvcsw, &ru->ru_nvcsw) || r32.ru_nsignals = r->ru_nsignals;
__put_user(r->ru_nivcsw, &ru->ru_nivcsw)) r32.ru_nvcsw = r->ru_nvcsw;
r32.ru_nivcsw = r->ru_nivcsw;
if (copy_to_user(ru, &r32, sizeof(r32)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
......
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