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
This commit is contained in:
parent
69dac2ea47
commit
8ea8a6804b
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user