| From 7690d2696daa9b03f4bcb7613310f4eff3d17b19 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Fri, 16 Jun 2023 11:03:34 +0200 |
| Subject: wifi: iwlwifi: dbg_ini: fix structure packing |
| |
| From: Arnd Bergmann <arnd@arndb.de> |
| |
| [ Upstream commit 424c82e8ad56756bb98b08268ffcf68d12d183eb ] |
| |
| The iwl_fw_ini_error_dump_range structure has conflicting alignment |
| requirements for the inner union and the outer struct: |
| |
| In file included from drivers/net/wireless/intel/iwlwifi/fw/dbg.c:9: |
| drivers/net/wireless/intel/iwlwifi/fw/error-dump.h:312:2: error: field within 'struct iwl_fw_ini_error_dump_range' is less aligned than 'union iwl_fw_ini_error_dump_range::(anonymous at drivers/net/wireless/intel/iwlwifi/fw/error-dump.h:312:2)' and is usually due to 'struct iwl_fw_ini_error_dump_range' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access] |
| union { |
| |
| As the original intention was apparently to make the entire structure |
| unaligned, mark the innermost members the same way so the union |
| becomes packed as well. |
| |
| Fixes: 973193554cae6 ("iwlwifi: dbg_ini: dump headers cleanup") |
| Signed-off-by: Arnd Bergmann <arnd@arndb.de> |
| Acked-by: Gregory Greenman <gregory.greenman@intel.com> |
| Link: https://lore.kernel.org/r/20230616090343.2454061-1-arnd@kernel.org |
| Signed-off-by: Johannes Berg <johannes.berg@intel.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/net/wireless/intel/iwlwifi/fw/error-dump.h | 6 +++--- |
| 1 file changed, 3 insertions(+), 3 deletions(-) |
| |
| diff --git a/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h b/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h |
| index 2e763678dbdb8..36bfc195a7722 100644 |
| --- a/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h |
| +++ b/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h |
| @@ -332,9 +332,9 @@ struct iwl_fw_ini_fifo_hdr { |
| struct iwl_fw_ini_error_dump_range { |
| __le32 range_data_size; |
| union { |
| - __le32 internal_base_addr; |
| - __le64 dram_base_addr; |
| - __le32 page_num; |
| + __le32 internal_base_addr __packed; |
| + __le64 dram_base_addr __packed; |
| + __le32 page_num __packed; |
| struct iwl_fw_ini_fifo_hdr fifo_hdr; |
| }; |
| __le32 data[]; |
| -- |
| 2.40.1 |
| |