casaroli commented on code in PR #21522:
URL: https://github.com/apache/nuttx/pull/21522#discussion_r4497813720


##########
net/rpmsg/rpmsg_sockif.c:
##########
@@ -1100,59 +1116,85 @@ static ssize_t rpmsg_socket_send_single(FAR struct 
socket *psock,
 {
   FAR struct rpmsg_socket_conn_s *conn = psock->s_conn;
   FAR struct rpmsg_socket_data_s *msg;
-  uint32_t len = rpmsg_socket_get_iovlen(buf, iovcnt);
-  uint32_t total = len + sizeof(uint32_t);
+  FAR uint8_t *msgpos;
+  ssize_t ret;
+  uint32_t len;
+  uint32_t total;
   uint32_t written = 0;
   uint32_t ipcsize;
   uint32_t space;
-  FAR uint8_t *msgpos;
-  int ret;
 
-  if (total > conn->sendsize)
+  ret = rpmsg_socket_get_iovlen(buf, iovcnt);
+  if (ret < 0)
+    {
+      return ret;
+    }
+
+  len = ret;
+  if (conn->sendsize < sizeof(uint32_t) ||
+      len > conn->sendsize - sizeof(uint32_t))
     {
       return -EFBIG;

Review Comment:
   A datagram larger than the peer buffer still gets `-EFBIG`, while a datagram 
larger than the rpmsg buffer now gets `-EMSGSIZE` (line 1179). POSIX 
`sendmsg()` uses `EMSGSIZE` for a message too long to send atomically, and so 
do `local_sendpacket.c:131` and `udp_sendto_buffered.c:310`.
   
   Fix: return `-EMSGSIZE` here too.



-- 
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]

Reply via email to