From b2217c935e3f30d15821b1c5183ab4dd4c9d9dd2 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Mon, 29 Sep 2025 12:21:49 -0700 Subject: [PATCH] net: lwip: ensure alignment of packet buffers Network packet buffers should be aligned to PKTALIGN. Add a compiler attribute to ensure this. Signed-off-by: Tim Harvey [jf: use __aligned(x) from ] Signed-off-by: Jerome Forissier --- net/lwip/net-lwip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/lwip/net-lwip.c b/net/lwip/net-lwip.c index 1a70cedfb58..8741f65fe12 100644 --- a/net/lwip/net-lwip.c +++ b/net/lwip/net-lwip.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,8 @@ void (*push_packet)(void *, int len) = 0; int net_try_count; static int net_restarted; int net_restart_wrap; -static uchar net_pkt_buf[(PKTBUFSRX) * PKTSIZE_ALIGN + PKTALIGN]; +static uchar net_pkt_buf[(PKTBUFSRX) * PKTSIZE_ALIGN + PKTALIGN] + __aligned(PKTALIGN); uchar *net_rx_packets[PKTBUFSRX]; uchar *net_rx_packet; const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -- 2.47.3