This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch releases/12.10
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/releases/12.10 by this push:
new 49ebc4598f net/utils: avoid unalign access g_tcp_connections_buffer
49ebc4598f is described below
commit 49ebc4598f287a58aeed508a48656627cc46d7c3
Author: dongjiuzhu1 <[email protected]>
AuthorDate: Wed May 7 11:55:05 2025 +0800
net/utils: avoid unalign access g_tcp_connections_buffer
the address is 0x3c270203, cause unaligned access usage Fault
(gdb) p g_tcp_connections
$1 = {pool = 0x3c270203 <g_tcp_connections_buffer> <error: Cannot access
memory at address 0x3c270203>,
prealloc = 8, dynalloc = 1, nodesize = -376, sem = {semcount = 32767, flags
= 0 '\000',
waitlist = {head = 0x0, tail = 0x0}}, freebuffers = {head = 0x0, tail =
0x0}}
Signed-off-by: dongjiuzhu1 <[email protected]>
---
net/utils/utils.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/utils/utils.h b/net/utils/utils.h
index cc7127ab5d..e325941b03 100644
--- a/net/utils/utils.h
+++ b/net/utils/utils.h
@@ -28,6 +28,7 @@
****************************************************************************/
#include <nuttx/config.h>
+#include <nuttx/compiler.h>
#include <stdlib.h>
@@ -88,7 +89,7 @@
(dynalloc) <= 0 ? (prealloc) : ((maxalloc) > 0 ? (maxalloc) : INT16_MAX)
#define NET_BUFPOOL_DECLARE(pool, nodesize, prealloc, dynalloc, maxalloc) \
- static char pool##_buffer[prealloc][nodesize]; \
+ static char pool##_buffer[prealloc][nodesize]
aligned_data(sizeof(uintptr_t)); \
static struct net_bufpool_s pool = \
{ \
pool##_buffer[0], \