From bc7114ab1694bb8ec1f5ea2d021567d65db6af67 Mon Sep 17 00:00:00 2001 From: zhengyu9 Date: Tue, 20 Aug 2024 15:57:04 +0800 Subject: [PATCH] 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 Signed-off-by: ligd --- fs/vfs/fs_poll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c index dfe04b9d64..e288ce9a6c 100644 --- a/fs/vfs/fs_poll.c +++ b/fs/vfs/fs_poll.c @@ -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)