From e3d865f6c2401e2d12a437dbff2ca72511dc46d1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 28 Apr 2017 11:02:54 -0600 Subject: [PATCH] In last changed to poll(),cConverted timeout to unsigned to eliminate the possibility of overflow of signed overflow. --- fs/vfs/fs_poll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c index c8288902105..55160d7faa4 100644 --- a/fs/vfs/fs_poll.c +++ b/fs/vfs/fs_poll.c @@ -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 && \ 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; #else - ticks = (timeout + (MSEC_PER_TICK - 1)) / MSEC_PER_TICK; + ticks = ((unsigned int)timeout + (MSEC_PER_TICK - 1)) / MSEC_PER_TICK; #endif /* Either wait for either a poll event(s), for a signal to occur,