masayuki2009 commented on PR #6041:
URL: https://github.com/apache/incubator-nuttx/pull/6041#issuecomment-1098499290

   @zhhyu7 
   In the first commit,  iovec_do() was modified.
   However, the change was reverted in the second commit without any comments.
   What is the intention of these changes?
   
   ```
   $ git show f60480a5dbb6aac6db06bc0b90b2e00e9691bca3
   ommit f60480a5dbb6aac6db06bc0b90b2e00e9691bca3
   Author: zhanghongyu <[email protected]>
   Date:   Sat Mar 26 16:41:13 2022 +0800
   
       rpmsg_usrsock: Support the wireless ioctl which contain pointer 1/2
       
       Signed-off-by: zhanghongyu <[email protected]>
   
   diff --git a/include/nuttx/wireless/wireless.h 
b/include/nuttx/wireless/wireless.h
   index 7b240db918..ed4f5297dd 100644
   --- a/include/nuttx/wireless/wireless.h
   +++ b/include/nuttx/wireless/wireless.h
   @@ -144,6 +144,15 @@
    
    #define SIOCSIWCOUNTRY      _WLIOC(0x0037)  /* Country code extension */
    
   +#define WL_IS80211POINTERCMD(cmd) ((cmd) == SIOCGIWSCAN || \
   +                                   (cmd) == SIOCSIWSCAN || \
   +                                   (cmd) == SIOCSIWCOUNTRY || \
   +                                   (cmd) == SIOCGIWRANGE || \
   +                                   (cmd) == SIOCSIWENCODEEXT || \
   +                                   (cmd) == SIOCGIWENCODEEXT || \
   +                                   (cmd) == SIOCGIWESSID || \
   +                                   (cmd) == SIOCSIWESSID)
   +
    /* Device-specific network IOCTL commands 
*******************************************/
    
    #define WL_NETFIRST         0x0000          /* First network command */
   diff --git a/net/usrsock/usrsock_dev.c b/net/usrsock/usrsock_dev.c
   index 6edbec639b..9a41ca9854 100644
   --- a/net/usrsock/usrsock_dev.c
   +++ b/net/usrsock/usrsock_dev.c
   @@ -222,7 +222,7 @@ static ssize_t iovec_do(FAR void *srcdst, size_t 
srcdstlen,
            }
        }
    
   -  return total;
   +  return total == 0 && iovcnt == 0 ? -1: total;
    }
   ...
   
   $ git show 4c693239c07891377960f4b0bed1704300c51866
   Author: zhanghongyu <[email protected]>
   Date:   Wed Apr 6 20:52:43 2022 +0800
   
       fix: usrsock iovec_do skip empty iov
       
       Signed-off-by: zhanghongyu <[email protected]>
   
   diff --git a/net/usrsock/usrsock_dev.c b/net/usrsock/usrsock_dev.c
   index 9a41ca9854..9102c4950c 100644
   --- a/net/usrsock/usrsock_dev.c
   +++ b/net/usrsock/usrsock_dev.c
   @@ -143,7 +143,7 @@ static ssize_t iovec_do(FAR void *srcdst, size_t 
srcdstlen,
    
      /* Rewind to correct position. */
    
   -  while (pos > 0 && iovcnt > 0)
   +  while (pos >= 0 && iovcnt > 0)
        {
          if (iov->iov_len <= pos)
            {
   @@ -222,7 +222,7 @@ static ssize_t iovec_do(FAR void *srcdst, size_t 
srcdstlen,
            }
        }
    
   -  return total == 0 && iovcnt == 0 ? -1: total;
   +  return total;
    }
   ```


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