Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/compat/linux/common



On Wed, Nov 09, 2005 at 05:52:33PM +1100, Simon Burge wrote:
> +               timeout_hz = (timeout.tv_sec * hz)
> +                          + ((timeout.tv_nsec * hz) / 1000000000);
> 
> It looks like we might have the chance of an overflow here.
> hz * 999,999,999 will be > 32bits for pretty much any value of hz.
> Maybe look at hzto() in kern_clock.c to see how it avoids
> overflow?

What about just defining timeout_hz as long long, then cast it to int
before using it?

-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost



Home | Main Index | Thread Index | Old Index