B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH batadv 0/2] batman-adv: enforce u16 MAC address alignment
@ 2026-08-22 13:14 Sven Eckelmann
  2026-08-22 13:14 ` [PATCH batadv 1/2] batman-adv: ensure u16 aligned mac address arrays on stack Sven Eckelmann
  2026-08-22 13:14 ` [PATCH batadv 2/2] batman-adv: ensure u16 aligned mac address in structs Sven Eckelmann
  0 siblings, 2 replies; 3+ messages in thread
From: Sven Eckelmann @ 2026-08-22 13:14 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Sashiko

Sashiko reported problems with mac addresses on the stack as part of
https://sashiko.dev/#/patchset/20260821094813.201800-1-sw%40simonwunderlich.de?part=5

> The mac array is allocated on the stack with 1-byte alignment by default.
[...]
> Because ether_addr_copy() casts the pointers to u16 to perform 16-bit
> operations on these architectures, it strictly requires both the source and
> destination pointers to be 2-byte aligned.

Annote MAC address ETH_ALEN arrays to avoid this problem in the most common
cases.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Sven Eckelmann (2):
      batman-adv: ensure u16 aligned mac address arrays on stack
      batman-adv: ensure u16 aligned mac address in structs

 net/batman-adv/bridge_loop_avoidance.c |  6 ++++--
 net/batman-adv/distributed-arp-table.c |  8 ++++----
 net/batman-adv/mesh-interface.c        | 12 ++++++++----
 net/batman-adv/multicast.c             |  6 +++---
 net/batman-adv/types.h                 | 26 +++++++++++++-------------
 5 files changed, 32 insertions(+), 26 deletions(-)
---
base-commit: f3c33e7fcb7e88cc099b783faf26f0494b774571
change-id: 20260822-mac-u16-alignment-d25da5f6e8cc

Best regards,
--  
Sven Eckelmann <sven@narfation.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-22 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-22 13:14 [PATCH batadv 0/2] batman-adv: enforce u16 MAC address alignment Sven Eckelmann
2026-08-22 13:14 ` [PATCH batadv 1/2] batman-adv: ensure u16 aligned mac address arrays on stack Sven Eckelmann
2026-08-22 13:14 ` [PATCH batadv 2/2] batman-adv: ensure u16 aligned mac address in structs Sven Eckelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox