Skip to content

Commit

Permalink
ntp: Remove redundant and incorrect parameter check
Browse files Browse the repository at this point in the history
The ADJ_SETOFFSET code redundantly checks the range of the nanoseconds
field of the time value. This field is checked again in the subsequent
call to timekeeping_inject_offset(). Also, as is, the check will not
detect whether the number of microseconds is out of range.

Let timekeeping_inject_offset() do the error checking.
 
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
Cc: johnstul@us.ibm.com
LKML-Reference: <20110218090724.GA2924@riccoc20.at.omicron.at>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Richard Cochran authored and Thomas Gleixner committed Feb 18, 2011
1 parent 22b7fcd commit db1c1cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/time/ntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,13 +650,13 @@ int do_adjtimex(struct timex *txc)

if (txc->modes & ADJ_SETOFFSET) {
struct timespec delta;
if ((unsigned long)txc->time.tv_usec >= NSEC_PER_SEC)
return -EINVAL;
delta.tv_sec = txc->time.tv_sec;
delta.tv_nsec = txc->time.tv_usec;
if (!(txc->modes & ADJ_NANO))
delta.tv_nsec *= 1000;
timekeeping_inject_offset(&delta);
result = timekeeping_inject_offset(&delta);
if (result)
return result;
}

getnstimeofday(&ts);
Expand Down

0 comments on commit db1c1cc

Please sign in to comment.