Subject: Re: CVS commit: src/sys/compat/linux/common
To: Simon Burge <simonb@wasabisystems.com>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: source-changes
Date: 11/09/2005 08:12:14
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