From: sashiko-bot@kernel.org
To: "Loic Poulain" <loic.poulain@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 6/9] net: of_net: Add of_get_nvmem_eui48() helper for EUI-48 lookup
Date: Thu, 02 Jul 2026 16:01:26 +0000 [thread overview]
Message-ID: <20260702160126.774D01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701-block-as-nvmem-v7-6-3fe8205ef0a8@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Replacing `memcpy()` with `ether_addr_copy()` introduces a strict 16-bit alignment requirement on the caller-provided address buffer, which will cause unaligned access exceptions on architectures lacking CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.
--
commit 4b3ab6cc908398547c262bcc34842d3a0a9fceab
Author: Loic Poulain <loic.poulain@oss.qualcomm.com>
net: of_net: Add of_get_nvmem_eui48() helper for EUI-48 lookup
This commit factors out the NVMEM EUI-48 retrieval logic into a new
of_get_nvmem_eui48() helper. The of_get_mac_address_nvmem() function is
updated to use this helper, changing how the MAC address is copied to the
caller's buffer.
> diff --git a/net/core/of_net.c b/net/core/of_net.c
> index 93ea425b9248a..11c1acca15126 100644
> --- a/net/core/of_net.c
> +++ b/net/core/of_net.c
[ ... ]
> @@ -75,27 +73,54 @@ int of_get_mac_address_nvmem(struct device_node *np, u8 *addr)
> return ret;
> }
>
> - cell = of_nvmem_cell_get(np, "mac-address");
[ ... ]
> - memcpy(addr, mac, ETH_ALEN);
> - kfree(mac);
> + ret = of_get_nvmem_eui48(np, "mac-address", mac);
> + if (ret)
> + return ret;
> +
> + if (!is_valid_ether_addr(mac))
> + return -EINVAL;
> +
> + ether_addr_copy(addr, mac);
[Severity: High]
Does this introduce an unaligned memory access issue on architectures lacking
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS?
By replacing memcpy() with ether_addr_copy(), the caller-provided 'addr' buffer
is now strictly required to be 16-bit aligned.
Callers like of_get_ethdev_address() pass a stack-allocated, 1-byte aligned u8
array:
net/core/of_net.c:of_get_ethdev_address() {
...
u8 addr[ETH_ALEN];
int ret;
ret = of_get_mac_address(np, addr);
...
}
Since of_get_mac_address() can call of_get_mac_address_nvmem(), this will cause
a hardware exception during probe when ether_addr_copy() casts the unaligned
pointer to u16* on architectures like ARMv5 or SPARC.
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701-block-as-nvmem-v7-0-3fe8205ef0a8@oss.qualcomm.com?part=6
next prev parent reply other threads:[~2026-07-02 16:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 16:00 [PATCH v7 0/9] Support for block device NVMEM providers Loic Poulain
2026-07-01 16:00 ` [PATCH v7 1/9] dt-bindings: mmc: Document fixed-layout NVMEM provider support Loic Poulain
2026-07-01 16:00 ` [PATCH v7 2/9] dt-bindings: net: wireless: qcom,ath10k: Document NVMEM cells Loic Poulain
2026-07-01 16:00 ` [PATCH v7 3/9] dt-bindings: bluetooth: qcom: Add NVMEM BD address cell Loic Poulain
2026-07-01 16:00 ` [PATCH v7 4/9] nvmem: layouts: Support fixed-layout as the nvmem device node itself Loic Poulain
2026-07-01 16:00 ` [PATCH v7 5/9] block: implement NVMEM provider Loic Poulain
2026-07-02 16:01 ` sashiko-bot
2026-07-01 16:00 ` [PATCH v7 6/9] net: of_net: Add of_get_nvmem_eui48() helper for EUI-48 lookup Loic Poulain
2026-07-02 16:01 ` sashiko-bot [this message]
2026-07-01 16:00 ` [PATCH v7 7/9] Bluetooth: hci_sync: Add NVMEM-backed BD address retrieval Loic Poulain
2026-07-02 16:01 ` sashiko-bot
2026-07-01 16:00 ` [PATCH v7 8/9] Bluetooth: qca: Set NVMEM BD address quirks when address is invalid Loic Poulain
2026-07-02 16:01 ` sashiko-bot
2026-07-01 16:00 ` [PATCH v7 9/9] arm64: dts: qcom: arduino-imola: Describe NVMEM layout for WiFi/BT addresses Loic Poulain
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=20260702160126.774D01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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