Re: Serious bug in recent Linux kernels

Matthew Hannigan (mha73@qantas.com.au)
Tue, 12 Jan 1999 09:46:50 +1100 (EST)


<delurk>

Dan Kegel <dank@alumni.caltech.edu> writes
> timeout*HZ can overflow and produce a bad positive result for
> some values of timeout, I think. Assuming timeout is
> a long (I don't have the source handy), how about
> if ((timeout < 0) || (timeout > LONG_MAX/HZ))
> timeout =3D MAX_SCHEDULE_TIMEOUT;
> else if (timeout > 0)
> timeout =3D (timeout*HZ+999)/1000+1;

Wouldn't it be wise to be explicit the assumptions on
the range of HZ by preceding things like this with
assertions?

The assertion could crash or do a printk; either way
it'd be something.

--
	-Matt

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/