Remove bogus use of useracc() in (clock_)nanosleep.
There's no point in pre-checking that we can access the user's rmtp pointer before we do it in copyout(). While here, improve style(9) compliance. Reviewed by: imp MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24409
This commit is contained in:
parent
cfb2be0cff
commit
d11edfe286
@ -2651,7 +2651,7 @@ freebsd32_user_clock_nanosleep(struct thread *td, clockid_t clock_id,
|
||||
{
|
||||
struct timespec32 rmt32, rqt32;
|
||||
struct timespec rmt, rqt;
|
||||
int error;
|
||||
int error, error2;
|
||||
|
||||
error = copyin(ua_rqtp, &rqt32, sizeof(rqt32));
|
||||
if (error)
|
||||
@ -2660,18 +2660,13 @@ freebsd32_user_clock_nanosleep(struct thread *td, clockid_t clock_id,
|
||||
CP(rqt32, rqt, tv_sec);
|
||||
CP(rqt32, rqt, tv_nsec);
|
||||
|
||||
if (ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0 &&
|
||||
!useracc(ua_rmtp, sizeof(rmt32), VM_PROT_WRITE))
|
||||
return (EFAULT);
|
||||
error = kern_clock_nanosleep(td, clock_id, flags, &rqt, &rmt);
|
||||
if (error == EINTR && ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0) {
|
||||
int error2;
|
||||
|
||||
CP(rmt, rmt32, tv_sec);
|
||||
CP(rmt, rmt32, tv_nsec);
|
||||
|
||||
error2 = copyout(&rmt32, ua_rmtp, sizeof(rmt32));
|
||||
if (error2)
|
||||
if (error2 != 0)
|
||||
error = error2;
|
||||
}
|
||||
return (error);
|
||||
|
@ -625,20 +625,15 @@ user_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags,
|
||||
const struct timespec *ua_rqtp, struct timespec *ua_rmtp)
|
||||
{
|
||||
struct timespec rmt, rqt;
|
||||
int error;
|
||||
int error, error2;
|
||||
|
||||
error = copyin(ua_rqtp, &rqt, sizeof(rqt));
|
||||
if (error)
|
||||
return (error);
|
||||
if (ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0 &&
|
||||
!useracc(ua_rmtp, sizeof(rmt), VM_PROT_WRITE))
|
||||
return (EFAULT);
|
||||
error = kern_clock_nanosleep(td, clock_id, flags, &rqt, &rmt);
|
||||
if (error == EINTR && ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0) {
|
||||
int error2;
|
||||
|
||||
error2 = copyout(&rmt, ua_rmtp, sizeof(rmt));
|
||||
if (error2)
|
||||
if (error2 != 0)
|
||||
error = error2;
|
||||
}
|
||||
return (error);
|
||||
|
Loading…
Reference in New Issue
Block a user