From: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
To: Alexander Wilhelm <alexander.wilhelm@westermo.com>,
Jeff Johnson <jjohnson@kernel.org>
Cc: linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: ath12k: fix MAC address copy on big endian
Date: Thu, 19 Mar 2026 11:00:22 +0800 [thread overview]
Message-ID: <44549364-7187-4b1a-b1fe-5bf6e309ec16@oss.qualcomm.com> (raw)
In-Reply-To: <20260317-fix-mac-addr-copy-on-big-endian-v1-1-b7b6c49cb07f@westermo.com>
On 3/17/2026 7:22 PM, Alexander Wilhelm wrote:
> The ath12k_dp_get_mac_addr function performs a simple memcpy from a
> CPU-native data types into an u8 array. On a big-endian architecture, this
> later results in a null‑pointer dereference. Convert the data to
curious how could this happen? how matter the endian, it is just six bytes which are not a
pointer hence can not be dereferenced, no?
> little‑endian first, then copy it into the target array.
>
> Signed-off-by: Alexander Wilhelm <alexander.wilhelm@westermo.com>
> ---
> drivers/net/wireless/ath/ath12k/dp.h | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath12k/dp.h b/drivers/net/wireless/ath/ath12k/dp.h
> index f8cfc7bb29dd..50957915dbf4 100644
> --- a/drivers/net/wireless/ath/ath12k/dp.h
> +++ b/drivers/net/wireless/ath/ath12k/dp.h
> @@ -647,8 +647,11 @@ int ath12k_dp_arch_rx_tid_delete_handler(struct ath12k_dp *dp,
>
> static inline void ath12k_dp_get_mac_addr(u32 addr_l32, u16 addr_h16, u8 *addr)
> {
> - memcpy(addr, &addr_l32, 4);
> - memcpy(addr + 4, &addr_h16, ETH_ALEN - 4);
> + __le32 le_addr_l32 = cpu_to_le32(addr_l32);
> + __le16 le_addr_h16 = cpu_to_le16(addr_h16);
> +
> + memcpy(addr, &le_addr_l32, 4);
> + memcpy(addr + 4, &le_addr_h16, ETH_ALEN - 4);
> }
>
> static inline struct ath12k_dp *
>
> ---
> base-commit: 702847e8cfd51856836a282db2073defd7cfd80c
> change-id: 20260317-fix-mac-addr-copy-on-big-endian-f1a4fea40184
>
> Best regards,
next prev parent reply other threads:[~2026-03-19 3:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 11:22 [PATCH] wifi: ath12k: fix MAC address copy on big endian Alexander Wilhelm
2026-03-19 3:00 ` Baochen Qiang [this message]
2026-03-19 7:01 ` Alexander Wilhelm
2026-03-19 8:07 ` Alexander Wilhelm
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=44549364-7187-4b1a-b1fe-5bf6e309ec16@oss.qualcomm.com \
--to=baochen.qiang@oss.qualcomm.com \
--cc=alexander.wilhelm@westermo.com \
--cc=ath12k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.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