Sarthak-Pandey commented on PR #20702:
URL: https://github.com/apache/nuttx/pull/20702#issuecomment-6576120551
Hi @xiaoxiang781216,
Thank you very much for the detailed review! I have addressed all the
feedback and updated the PR with a clean commit history:
### Summary of Changes:
1. **`mm/iob/iob_copyin.c`**:
- Moved `iob_copyin_iov_internal()` to the Private Functions section.
- Renamed `total_copied` to `total` per NuttX naming conventions.
- Removed redundant `(size_t)` casts from overflow check (`INT_MAX -
total` and `INT_MAX - offset`).
2. **`mm/iob/iob_copyout.c`**:
- Moved `iob_copyout_iov()` to the Private Functions section.
- Renamed `total_copied` to `total` and removed `datalen`.
- Simplified loop condition to `for (i = 0; i < iovlen && total < len;
i++)` using `MIN(iov[i].iov_len, len - total)`.
- Removed redundant type casts.
3. **`net/can/can_recvmsg.c`**:
- Reused original `offset` and `recvlen`, eliminating `datalen` in
`can_recvfrom_newdata()`.
4. **`net/inet/inet_sockif.c`**:
- Moved variable declarations to the top of the block.
- Delayed `buf` and `len` assignment strictly inside `if (msg->msg_iovlen
== 1)` to eliminate dead stores on multi-vector paths.
5. **`net/local/local_recvmsg.c`, `local.h`, `local_conn.c` (Concurrency &
One-Call Receive)**:
- Fixed the multi-threading race condition identified in review: removed
the outer iterative loop from `local_recvmsg()` so reception occurs in a single
call (`len = psock_stream_recvfrom(psock, msg, flags);`).
- Added `mutex_t lc_recvlock` to `struct local_conn_s` (symmetrical to
`lc_sendlock`), initialized in `local_alloc()` and destroyed in `local_free()`.
- Protected the scatter receive across `msg_iov` under `lc_recvlock`
inside `psock_stream_recvfrom()`, ensuring concurrent threads cannot enter and
interleave stream reads from the FIFO.
All modified files have been verified with `./tools/nxstyle` and pass with 0
errors and 0 warnings. Please take another look!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]