Re: [PATCH] net: 8139too: use unaligned helpers when setting MAC address
flat view
From: Lucas <hidden>
Date: 2026-08-24 15:01:03
Also in:
lkml
Hi Andrew, After looking into this further, I don't think this warrants a fix for the net tree. dev->dev_addr is backed by a MAX_ADDR_LEN buffer, so the second 32-bit read does not actually go out of bounds, and I don't have a concrete case where the alignment causes a problem. I'll drop the patch. Thanks for the review. Regards, Lucas On Mon, Aug 24, 2026 at 4:38 PM Andrew Lunn [off-list ref] wrote:
On Mon, Aug 24, 2026 at 12:37:09PM +0200, Lucas Poupeau wrote:quoted
From: Lucas <redacted> rtl8139_set_mac_address() accesses dev->dev_addr by casting it to u32 pointers. Besides potentially performing unaligned accesses, the second read starts at offset 4 and reads 32 bits even though only two bytes remain in the Ethernet address. Use get_unaligned_le32() and get_unaligned_le16() to read the address with the appropriate width and endianness. This also fixes the Sparse type warnings caused by passing __le32 values to iowrite32(). Signed-off-by: Lucas Poupeau <redacted>If you are targeting the net tree, you need a Fixes: tag. https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html Does this bother people? https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html Andrew --- pw-bot: cr