From 8ea8a6804b31df52cdc4fb6d9bed844913154664 Mon Sep 17 00:00:00 2001 From: John Polstra Date: Sat, 20 Jul 2002 23:48:59 +0000 Subject: [PATCH] Fix overflows in intermediate calculations in sysctl_msec_to_ticks(). At hz values of 1000 and above the overflows caused net.inet.tcp.keepidle to be reported as negative. MFC after: 3 days --- sys/netinet/tcp_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index c9b423b0683b..421c5c3fe1c3 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -74,13 +74,13 @@ sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS) int error, s, tt; tt = *(int *)oidp->oid_arg1; - s = tt * 1000 / hz; + s = (int)((int64_t)tt * 1000 / hz); error = sysctl_handle_int(oidp, &s, 0, req); if (error || !req->newptr) return (error); - tt = s * hz / 1000; + tt = (int)((int64_t)s * hz / 1000); if (tt < 1) return (EINVAL);