nanosleep: use copy_from_user instead of direct access
This commit is contained in:
@@ -5031,16 +5031,15 @@ SYSCALL_DECLARE(nanosleep)
|
|||||||
|
|
||||||
unsigned long ts = rdtsc();
|
unsigned long ts = rdtsc();
|
||||||
|
|
||||||
/* Check validity of arguments */
|
|
||||||
if (copy_from_user(&_tv, tv, sizeof(*tv))) {
|
if (copy_from_user(&_tv, tv, sizeof(*tv))) {
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tv->tv_sec < 0 || tv->tv_nsec >= NS_PER_SEC) {
|
if (_tv.tv_sec < 0 || _tv.tv_nsec >= NS_PER_SEC) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nanosecs = tv->tv_sec * NS_PER_SEC + tv->tv_nsec;
|
nanosecs = _tv.tv_sec * NS_PER_SEC + _tv.tv_nsec;
|
||||||
tscs = nanosecs * 1000 / ihk_mc_get_ns_per_tsc();
|
tscs = nanosecs * 1000 / ihk_mc_get_ns_per_tsc();
|
||||||
|
|
||||||
/* Spin wait */
|
/* Spin wait */
|
||||||
|
|||||||
Reference in New Issue
Block a user