In last changed to poll(),cConverted timeout to unsigned to eliminate the possibility of overflow of signed overflow.

This commit is contained in:
Gregory Nutt 2017-04-28 11:02:54 -06:00
parent 37ca797d1c
commit e3d865f6c2
1 changed files with 2 additions and 2 deletions

View File

@ -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,