[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260122085102.1117651-1-aleksandr.loktionov@intel.com>
Date: Thu, 22 Jan 2026 09:51:02 +0100
From: Aleksandr Loktionov <aleksandr.loktionov@...el.com>
To: intel-wired-lan@...ts.osuosl.org,
anthony.l.nguyen@...el.com,
aleksandr.loktionov@...el.com
Cc: netdev@...r.kernel.org,
Jedrzej Jagielski <jedrzej.jagielski@...el.com>
Subject: [PATCH iwl-next v1] ixgbe: fix type punning in ixgbe_update_flash_X550
Add a u32 buffer array member to union ixgbe_hic_hdr2 and use it
directly instead of casting the union address to u32 pointer. This
avoids potential strict aliasing violations and makes the code more
explicit about the buffer usage.
The ixgbe_host_interface_command function expects a void* buffer, so
providing a proper u32 array member in the union is the correct
approach rather than relying on pointer casting. This eliminates the
type punning issue where we were casting the union pointer to u32*.
By using buffer.buf instead of &buffer, we pass the address of the
u32 array directly, which is semantically correct and avoids any
potential undefined behavior from strict aliasing rule violations.
Fixes: 49425dfc7451 ("ixgbe: Add support for x550em_a 10G MAC type")
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@...el.com>
Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@...el.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 1 +
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
index 61f2ef6..eb5bf3b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
@@ -2798,6 +2798,7 @@ struct ixgbe_hic_hdr2_rsp {
};
union ixgbe_hic_hdr2 {
+ u32 buf[1];
struct ixgbe_hic_hdr2_req req;
struct ixgbe_hic_hdr2_rsp rsp;
};
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
index 76d2fa3..4a0ccbf 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
@@ -1228,7 +1228,7 @@ static int ixgbe_update_flash_X550(struct ixgbe_hw *hw)
buffer.req.buf_lenl = FW_SHADOW_RAM_DUMP_LEN;
buffer.req.checksum = FW_DEFAULT_CHECKSUM;
- status = ixgbe_host_interface_command(hw, &buffer, sizeof(buffer),
+ status = ixgbe_host_interface_command(hw, buffer.buf, sizeof(buffer),
IXGBE_HI_COMMAND_TIMEOUT, false);
return status;
}
--
2.52.0
Powered by blists - more mailing lists