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 2023/10/21 02:55:35 UTC
[nuttx] branch master updated: usrsock: Make the field of usrsock_request native alignment
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/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 3ad28c28aa usrsock: Make the field of usrsock_request native alignment
3ad28c28aa is described below
commit 3ad28c28aa53690c17700840a8f294bd48a8ca8f
Author: zhanghongyu <zh...@xiaomi.com>
AuthorDate: Thu Oct 19 20:53:36 2023 +0800
usrsock: Make the field of usrsock_request native alignment
There is a risk that interfaces such as psock_ioctl/psock_setsockopt
will cause paramete to be not four-byte aligned after calculating the
offset, so align the length of the structure with parameters by four
bytes.
Signed-off-by: zhanghongyu <zh...@xiaomi.com>
---
drivers/usrsock/usrsock_rpmsg.c | 1 -
include/nuttx/net/usrsock.h | 9 ++++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/usrsock/usrsock_rpmsg.c b/drivers/usrsock/usrsock_rpmsg.c
index 74924bd04f..25e188a861 100644
--- a/drivers/usrsock/usrsock_rpmsg.c
+++ b/drivers/usrsock/usrsock_rpmsg.c
@@ -94,7 +94,6 @@ static int usrsock_rpmsg_send_dns_request(FAR void *arg,
dns->head.reqid = USRSOCK_RPMSG_DNS_REQUEST;
dns->head.xid = 0;
- dns->head.reserved = 0;
dns->addrlen = addrlen;
memcpy(dns + 1, addr, addrlen);
diff --git a/include/nuttx/net/usrsock.h b/include/nuttx/net/usrsock.h
index 9336c06353..43c7ef604a 100644
--- a/include/nuttx/net/usrsock.h
+++ b/include/nuttx/net/usrsock.h
@@ -100,8 +100,7 @@ enum usrsock_message_types_e
begin_packed_struct struct usrsock_request_common_s
{
uint32_t xid;
- int8_t reqid;
- int8_t reserved;
+ uint32_t reqid;
} end_packed_struct;
begin_packed_struct struct usrsock_request_socket_s
@@ -157,9 +156,9 @@ begin_packed_struct struct usrsock_request_sendto_s
struct usrsock_request_common_s head;
int16_t usockid;
+ uint16_t addrlen;
int32_t flags;
uint32_t buflen;
- uint16_t addrlen;
} end_packed_struct;
begin_packed_struct struct usrsock_request_recvfrom_s
@@ -167,9 +166,9 @@ begin_packed_struct struct usrsock_request_recvfrom_s
struct usrsock_request_common_s head;
int16_t usockid;
+ uint16_t max_addrlen;
int32_t flags;
uint32_t max_buflen;
- uint16_t max_addrlen;
} end_packed_struct;
begin_packed_struct struct usrsock_request_setsockopt_s
@@ -213,8 +212,8 @@ begin_packed_struct struct usrsock_request_ioctl_s
struct usrsock_request_common_s head;
int16_t usockid;
- int32_t cmd;
uint16_t arglen;
+ int32_t cmd;
} end_packed_struct;
begin_packed_struct struct usrsock_request_shutdown_s