anchao commented on code in PR #7616: URL: https://github.com/apache/incubator-nuttx/pull/7616#discussion_r1027227607
########## net/icmp/icmp_recvmsg.c: ########## @@ -227,79 +227,35 @@ static inline ssize_t icmp_readahead(FAR struct icmp_conn_s *conn, FAR struct sockaddr_in *from, FAR socklen_t *fromlen) { - FAR struct sockaddr_in bitbucket; FAR struct iob_s *iob; ssize_t ret = -ENODATA; - int recvlen; /* Check there is any ICMP replies already buffered in a read-ahead * buffer. */ if ((iob = iob_peek_queue(&conn->readahead)) != NULL) { - FAR struct iob_s *tmp; - uint16_t offset; - uint8_t addrsize; - DEBUGASSERT(iob->io_pktlen > 0); - /* Transfer that buffered data from the I/O buffer chain into - * the user buffer. - */ - - /* First get the size of the address */ - - recvlen = iob_copyout(&addrsize, iob, sizeof(uint8_t), 0); - if (recvlen != sizeof(uint8_t)) - { - ret = -EIO; - goto out; - } - - offset = sizeof(uint8_t); - - if (addrsize > sizeof(struct sockaddr_in)) - { - ret = -EINVAL; - goto out; - } - /* Then get address */ - if (from == NULL) - { - from = &bitbucket; - } - - recvlen = iob_copyout((FAR uint8_t *)from, iob, addrsize, offset); - if (recvlen != addrsize) + if (from) Review Comment: Done -- 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