diff options
author | jdp <jdp@FreeBSD.org> | 2002-07-20 23:48:59 +0000 |
---|---|---|
committer | jdp <jdp@FreeBSD.org> | 2002-07-20 23:48:59 +0000 |
commit | 4a190d70152293c089b8a53c82687bd958d61e6f (patch) | |
tree | bad0f99dbe39584f797f0b3d292a4ef3d07f4b35 /sys/netinet/tcp_timer.c | |
parent | 25dc25ceae781e9920e3e273b5b74cb1b2e660ad (diff) | |
download | FreeBSD-src-4a190d70152293c089b8a53c82687bd958d61e6f.zip FreeBSD-src-4a190d70152293c089b8a53c82687bd958d61e6f.tar.gz |
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
Diffstat (limited to 'sys/netinet/tcp_timer.c')
-rw-r--r-- | sys/netinet/tcp_timer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index c9b423b..421c5c3 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); |