You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/01/04 18:05:58 UTC

[incubator-nuttx] branch master updated: socket: extend socket_storage for rpmsg_socket addrinfo

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 6ec006e  socket: extend socket_storage for rpmsg_socket addrinfo
6ec006e is described below

commit 6ec006ee02ca685483cb15fa78352012ee22995b
Author: Jiuzhu Dong <do...@xiaomi.com>
AuthorDate: Mon Dec 27 16:44:16 2021 +0800

    socket: extend socket_storage for rpmsg_socket addrinfo
    
    rexecd.c: In function 'rexecd_main':
    rexecd.c:191:9: warning: array subscript 18 is outside array bounds of 'struct sockaddr_storage[1]' [-Warray-bounds]
      191 |         snprintf(((FAR struct sockaddr_rpmsg *)&addr)->rp_name,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      192 |                  RPMSG_SOCKET_NAME_SIZE, "%d", REXECD_PORT);
          |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    rexecd.c:142:27: note: while referencing 'addr'
      142 |   struct sockaddr_storage addr;
    
    Signed-off-by: Jiuzhu Dong <do...@xiaomi.com>
---
 include/sys/socket.h | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/include/sys/socket.h b/include/sys/socket.h
index 8ce2519..7c86626 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -284,23 +284,13 @@
  * aligned at an appropriate boundary so that pointers to it can be cast
  * as pointers to protocol-specific address structures and used to access
  * the fields of those structures without alignment problems.
- *
- * REVISIT: sizeof(struct sockaddr_storge) should be 128 bytes.
  */
 
-#ifdef CONFIG_NET_IPv6
 struct sockaddr_storage
 {
   sa_family_t ss_family;       /* Address family */
-  char        ss_data[26];     /* 26-bytes of address data */
+  char        ss_data[126];    /* 126-bytes of address data */
 };
-#else
-struct sockaddr_storage
-{
-  sa_family_t ss_family;       /* Address family */
-  char        ss_data[14];     /* 14-bytes of address data */
-};
-#endif
 
 /* The sockaddr structure is used to define a socket address which is used
  * in the bind(), connect(), getpeername(), getsockname(), recvfrom(), and