pkarashchenko commented on a change in pull request #5526: URL: https://github.com/apache/incubator-nuttx/pull/5526#discussion_r808875154
########## File path: net/tcp/tcp_send_buffered.c ########## @@ -1108,6 +1117,15 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, nonblock = _SS_ISNONBLOCK(conn->sconn.s_flags) || (flags & MSG_DONTWAIT) != 0; + expire = _SO_TIMEOUT(conn->sconn.s_sndtimeo); + if (expire != UINT_MAX) + { + expire += TICK2MSEC(clock_systime_ticks()); + if (expire == UINT_MAX) + { + expire--; Review comment: `clock_systime_ticks` is either 32 or 64 bits and clock is continuously incremented so sequential `TICK2MSEC(clock_systime_ticks())` can be `TICK2MSEC(0xFFFFFFFF)` -> `TICK2MSEC(1)`. For example `_SO_TIMEOUT(conn->sconn.s_sndtimeo)` is `UINT_MAX - 5`, then we call `expire += TICK2MSEC(0xFFFFFFFF);` and that will most probably overflow and then we check `if (expire == UINT_MAX)` that is not hit. Please describe more the boundary use cases so we can be sure that timeout logic is bulletproof. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org