Messages in this thread | | | Date | Sun, 10 Jan 1999 18:22:15 -0800 | From | Dan Kegel <> | Subject | Re: Serious bug in recent Linux kernels |
| |
Guest section DW schrieb: > ... must not produce a negative timeout. The change below makes sure of that ... > > + if (timeout > 0) > + timeout = (timeout*HZ+999)/1000+1; > if (timeout < 0) > timeout = MAX_SCHEDULE_TIMEOUT; > - else if (timeout) > - timeout = (timeout*HZ+999)/1000+1; > > [the expression (timeout*HZ+999)/1000+1 is also a bit peculiar, > but I have not changed it]
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 = MAX_SCHEDULE_TIMEOUT; else if (timeout > 0) timeout = (timeout*HZ+999)/1000+1; ? - Dan
-- Speaking only for myself, not for my employer
- 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/
| |