B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sven Eckelmann <sven@narfation.org>, Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH batadv 0/2] batman-adv: enforce u16 MAC address alignment
Date: Sat, 22 Aug 2026 15:14:02 +0200	[thread overview]
Message-ID: <20260822-mac-u16-alignment-v1-0-bafa0040ada7@narfation.org> (raw)

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>


             reply	other threads:[~2026-08-22 13:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22 13:14 Sven Eckelmann [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260822-mac-u16-alignment-v1-0-bafa0040ada7@narfation.org \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=sashiko-bot@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox