Skip to content

Commit

Permalink
ntp: use unsigned input for do_div()
Browse files Browse the repository at this point in the history
The kernel NTP code shouldn't hand 64-bit *signed* values to do_div().  Make it
instead hand 64-bit unsigned values.  This gets rid of a couple of warnings.

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
David Howells authored and Thomas Gleixner committed Mar 9, 2008
1 parent 84c6f60 commit e48af19
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions kernel/time/ntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,16 @@ int do_adjtimex(struct timex *txc)
freq_adj = shift_right(freq_adj, time_constant * 2 +
(SHIFT_PLL + 2) * 2 - SHIFT_NSEC);
if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) {
u64 utemp64;
temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL);
if (time_offset < 0) {
temp64 = -temp64;
do_div(temp64, mtemp);
freq_adj -= temp64;
utemp64 = -temp64;
do_div(utemp64, mtemp);
freq_adj -= utemp64;
} else {
do_div(temp64, mtemp);
freq_adj += temp64;
utemp64 = temp64;
do_div(utemp64, mtemp);
freq_adj += utemp64;
}
}
freq_adj += time_freq;
Expand Down

0 comments on commit e48af19

Please sign in to comment.