fs/vfs: result_independent_of_operands

timeout is a type of int
in MSEC2TICK, timeout may be multiplied by USEC_PER_MSEC
and the result may be out of range of int
Besides, this will induce following ERROR while running simulator:
vfs/fs_poll.c:498:38: runtime error: signed integer overflow:
19768268 * 1000 cannot be represented in type 'int'

Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
zhengyu9 2024-08-20 15:57:04 +08:00 committed by Xiang Xiao
parent d637d5b66d
commit bc7114ab16
1 changed files with 1 additions and 1 deletions

View File

@ -495,7 +495,7 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
* will return immediately.
*/
ret = nxsem_tickwait(&sem, MSEC2TICK(timeout));
ret = nxsem_tickwait(&sem, MSEC2TICK((clock_t)timeout));
if (ret < 0)
{
if (ret == -ETIMEDOUT)