Skip to contentSkip to conversation

Make the kernel NTP code hand 64-bit *unsigned* values to do_div() [try #2]

PATCH In review David Howells 1 participant 2 messages Feb 21, 2008 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make the kernel NTP code hand 64-bit *unsigned* values to do_div() [try #2]

From: David Howells <[email protected]>

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.

---

 kernel/time/ntp.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
kernel/time/ntp.c +5 -3
index c88b591..3bead00 100644
@@ -342,13 +342,15 @@ 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);
+			    utemp64 = -temp64;
+			    do_div(utemp64, mtemp);
 			    freq_adj -= temp64;
 			} else {
-			    do_div(temp64, mtemp);
+			    utemp64 = temp64;
+			    do_div(utemp64, mtemp);
 			    freq_adj += temp64;
 			}
 		    }
#1 lore raw
Quoted 2 lines · David Howells

Subject: [PATCH] Make the kernel NTP code hand 64-bit *unsigned* values to

	do_div() [try #2]

Ignore try #2. I forgot to commit the changes before mailing.

David