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

acassis 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 a5485d6c53 net/utils: avoid unalign access g_tcp_connections_buffer
a5485d6c53 is described below

commit a5485d6c530c2b7f597d22d90ab155cf9b0bad35
Author: dongjiuzhu1 <dongjiuz...@xiaomi.com>
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 <dongjiuz...@xiaomi.com>
---
 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], \

Reply via email to