In last changed to poll(),cConverted timeout to unsigned to eliminate the possibility of overflow of signed overflow.
This commit is contained in:
parent
37ca797d1c
commit
e3d865f6c2
|
@ -401,10 +401,10 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
|
||||||
|
|
||||||
#if (MSEC_PER_TICK * USEC_PER_MSEC) != USEC_PER_TICK && \
|
#if (MSEC_PER_TICK * USEC_PER_MSEC) != USEC_PER_TICK && \
|
||||||
defined(CONFIG_HAVE_LONG_LONG)
|
defined(CONFIG_HAVE_LONG_LONG)
|
||||||
ticks = ((long long)timeout * USEC_PER_MSEC) + (USEC_PER_TICK - 1) /
|
ticks = ((unsigned long long)timeout * USEC_PER_MSEC) + (USEC_PER_TICK - 1) /
|
||||||
USEC_PER_TICK;
|
USEC_PER_TICK;
|
||||||
#else
|
#else
|
||||||
ticks = (timeout + (MSEC_PER_TICK - 1)) / MSEC_PER_TICK;
|
ticks = ((unsigned int)timeout + (MSEC_PER_TICK - 1)) / MSEC_PER_TICK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Either wait for either a poll event(s), for a signal to occur,
|
/* Either wait for either a poll event(s), for a signal to occur,
|
||||||
|
|
Loading…
Reference in New Issue