lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 21 Feb 2008 15:54:02 +0000
From:	David Howells <dhowells@...hat.com>
To:	torvalds@...l.org, akpm@...ux-foundation.org, zippel@...ux-m68k.org
Cc:	linux-kernel@...r.kernel.org, dhowells@...hat.com
Subject: [PATCH] Make the kernel NTP code hand 64-bit *unsigned* values to
	do_div()

From: David Howells <dhowells@...hat.com>

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@...hat.com>
---

 kernel/time/ntp.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index c88b591..3bead00 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -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;
 			}
 		    }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ