intel-wired-lan.osuosl.org archive mirror
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH iwl-net v2] ixgbe: fix ixgbe_orom_civd_info struct layout
@ 2025-07-31 12:45 Jedrzej Jagielski
  2025-08-01  9:24 ` Simon Horman
  2025-08-25  6:28 ` Rinitha, SX
  0 siblings, 2 replies; 3+ messages in thread
From: Jedrzej Jagielski @ 2025-07-31 12:45 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: anthony.l.nguyen, netdev, Jedrzej Jagielski, Aleksandr Loktionov

The current layout of struct ixgbe_orom_civd_info causes incorrect data
storage due to compiler-inserted padding. This results in issues when
writing OROM data into the structure.

Add the __packed attribute to ensure the structure layout matches the
expected binary format without padding.

Fixes: 70db0788a262 ("ixgbe: read the OROM version information")
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
---
v2: use get_unaligned_le32() per Simon's suggestion
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c      | 2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
index 71ea25de1bac..754c176fd4a7 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
@@ -3123,7 +3123,7 @@ static int ixgbe_get_orom_ver_info(struct ixgbe_hw *hw,
 	if (err)
 		return err;
 
-	combo_ver = le32_to_cpu(civd.combo_ver);
+	combo_ver = get_unaligned_le32(&civd.combo_ver);
 
 	orom->major = (u8)FIELD_GET(IXGBE_OROM_VER_MASK, combo_ver);
 	orom->patch = (u8)FIELD_GET(IXGBE_OROM_VER_PATCH_MASK, combo_ver);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h
index 09df67f03cf4..38a41d81de0f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h
@@ -1150,7 +1150,7 @@ struct ixgbe_orom_civd_info {
 	__le32 combo_ver;	/* Combo Image Version number */
 	u8 combo_name_len;	/* Length of the unicode combo image version string, max of 32 */
 	__le16 combo_name[32];	/* Unicode string representing the Combo Image version */
-};
+} __packed;
 
 /* Function specific capabilities */
 struct ixgbe_hw_func_caps {
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Intel-wired-lan] [PATCH iwl-net v2] ixgbe: fix ixgbe_orom_civd_info struct layout
  2025-07-31 12:45 [Intel-wired-lan] [PATCH iwl-net v2] ixgbe: fix ixgbe_orom_civd_info struct layout Jedrzej Jagielski
@ 2025-08-01  9:24 ` Simon Horman
  2025-08-25  6:28 ` Rinitha, SX
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-08-01  9:24 UTC (permalink / raw)
  To: Jedrzej Jagielski
  Cc: intel-wired-lan, anthony.l.nguyen, netdev, Aleksandr Loktionov

On Thu, Jul 31, 2025 at 02:45:33PM +0200, Jedrzej Jagielski wrote:
> The current layout of struct ixgbe_orom_civd_info causes incorrect data
> storage due to compiler-inserted padding. This results in issues when
> writing OROM data into the structure.
> 
> Add the __packed attribute to ensure the structure layout matches the
> expected binary format without padding.
> 
> Fixes: 70db0788a262 ("ixgbe: read the OROM version information")
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
> ---
> v2: use get_unaligned_le32() per Simon's suggestion

Thanks for the update.

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Intel-wired-lan] [PATCH iwl-net v2] ixgbe: fix ixgbe_orom_civd_info struct layout
  2025-07-31 12:45 [Intel-wired-lan] [PATCH iwl-net v2] ixgbe: fix ixgbe_orom_civd_info struct layout Jedrzej Jagielski
  2025-08-01  9:24 ` Simon Horman
@ 2025-08-25  6:28 ` Rinitha, SX
  1 sibling, 0 replies; 3+ messages in thread
From: Rinitha, SX @ 2025-08-25  6:28 UTC (permalink / raw)
  To: Jagielski, Jedrzej, intel-wired-lan@lists.osuosl.org
  Cc: Nguyen, Anthony L, netdev@vger.kernel.org, Jagielski, Jedrzej,
	Loktionov, Aleksandr

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Jedrzej Jagielski
> Sent: 31 July 2025 18:16
> To: intel-wired-lan@lists.osuosl.org
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; netdev@vger.kernel.org; Jagielski, Jedrzej <jedrzej.jagielski@intel.com>; Loktionov, Aleksandr <aleksandr.loktionov@intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-net v2] ixgbe: fix ixgbe_orom_civd_info struct layout
>
> The current layout of struct ixgbe_orom_civd_info causes incorrect data storage due to compiler-inserted padding. This results in issues when writing OROM data into the structure.
>
> Add the __packed attribute to ensure the structure layout matches the expected binary format without padding.
>
> Fixes: 70db0788a262 ("ixgbe: read the OROM version information")
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
> ---
> v2: use get_unaligned_le32() per Simon's suggestion
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c      | 2 +-
> drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>

Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-25  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-31 12:45 [Intel-wired-lan] [PATCH iwl-net v2] ixgbe: fix ixgbe_orom_civd_info struct layout Jedrzej Jagielski
2025-08-01  9:24 ` Simon Horman
2025-08-25  6:28 ` Rinitha, SX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).