Skip to content

batman-adv: enforce u16 MAC address alignment

Sven Eckelmann batman 1 version New

Get series with b4
b4 am [email protected] change-id 20260822-mac-u16-alignment-d25da5f6e8cc

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2batman-adv: ensure u16 aligned mac address arrays on stacknet/batman-adv/bridge_loop_avoidance.c net/batman-adv/distributed-arp-table.c net/batman-adv/mesh-interface.c +1 more+19 -130 replies
2/2batman-adv: ensure u16 aligned mac address in structsnet/batman-adv/types.h+13 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH batadv 0/2] batman-adv: enforce u16 MAC address alignment

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

Quoted 1 line

The mac array is allocated on the stack with 1-byte alignment by default.

[...]

Quoted 3 lines

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.

---
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,

Signature · 1 line
Sven Eckelmann <[email protected]>