lkml.org 
[lkml]   [1999]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Serious bug in recent Linux kernels

<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/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.034 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site