+ Kalle, Johannes, Miri and Rotem On 11/29/24 17:13, Sasha Levin wrote: > Hi folks, > > After this PR, I started (very rarely) seeing the following warning: > > [ 12.020686] UBSAN: shift-out-of-bounds in drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c:1333:47 > [ 12.029663] shift exponent 32 is too large for 32-bit type 'long unsigned int' > [ 12.036900] CPU: 2 UID: 0 PID: 167 Comm: modprobe Tainted: G W 6.12.0 #1 > [ 12.044988] Tainted: [W]=WARN > [ 12.047960] Hardware name: LENOVO Morphius/Morphius, BIOS Google_Morphius.13434.60.0 10/08/2020 > [ 12.056653] Call Trace: > [ 12.059105] dump_stack_lvl+0x94/0xa4 > [ 12.062774] dump_stack+0x12/0x18 > [ 12.066095] __ubsan_handle_shift_out_of_bounds+0x156/0x320 > [ 12.071676] iwl_dbg_tlv_init_cfg.cold+0x5d/0x67 [iwlwifi] > [ 12.077198] _iwl_dbg_tlv_time_point+0x2be/0x364 [iwlwifi] > [ 12.082717] ? __local_bh_enable_ip+0x6b/0xe8 > [ 12.087078] ? _raw_spin_unlock_bh+0x25/0x28 > [ 12.091355] iwl_run_unified_mvm_ucode+0xb0/0x380 [iwlmvm] > [ 12.096859] ? 0xf89c9000 > [ 12.099486] ? iwl_trans_pcie_start_hw+0xbd/0x344 [iwlwifi] > [ 12.105090] ? 0xf89c9000 > [ 12.107719] iwl_run_init_mvm_ucode+0x213/0x428 [iwlmvm] > [ 12.113059] ? mutex_unlock+0xb/0x10 > [ 12.116637] ? iwl_trans_pcie_start_hw+0xbd/0x344 [iwlwifi] > [ 12.122244] iwl_mvm_start_get_nvm+0x91/0x204 [iwlmvm] > [ 12.127410] ? iwl_mvm_mei_scan_filter_init+0x65/0x7c [iwlmvm] > [ 12.133275] iwl_op_mode_mvm_start+0x9e0/0xd08 [iwlmvm] > [ 12.138532] ? iwl_mvm_start_get_nvm+0x204/0x204 [iwlmvm] > [ 12.143955] _iwl_op_mode_start.isra.0+0x9a/0xd0 [iwlwifi] > [ 12.149477] iwl_opmode_register+0x5a/0xbc [iwlwifi] > [ 12.154474] ? 0xf87fc000 > [ 12.157100] iwl_mvm_init+0x21/0x1000 [iwlmvm] > [ 12.161562] ? 0xf87fc000 > [ 12.164188] do_one_initcall+0x63/0x2a8 > [ 12.168027] ? __create_object+0x56/0x84 > [ 12.171960] do_init_module+0x53/0x1f4 > [ 12.175716] load_module+0x746/0x818 > [ 12.179296] ? __probestub_module_put+0x4/0x4 > [ 12.183659] init_module_from_file+0x80/0xa8 > [ 12.187936] idempotent_init_module+0xe4/0x260 > [ 12.192386] __ia32_sys_finit_module+0x4f/0xb4 > [ 12.196834] ia32_sys_call+0x2bb/0x2e44 > [ 12.200672] __do_fast_syscall_32+0x5b/0xd8 > [ 12.204860] do_fast_syscall_32+0x2b/0x60 > [ 12.208873] do_SYSENTER_32+0x15/0x18 > [ 12.212538] entry_SYSENTER_32+0xa6/0x115 > [ 12.216551] EIP: 0xb7f28579 > [ 12.219350] Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76 > [ 12.238098] EAX: ffffffda EBX: 00000000 ECX: 0934ba50 EDX: 00000000 > [ 12.244364] ESI: 0934ba50 EDI: 0934b8c0 EBP: 0934ba50 ESP: bfb8fd88 > [ 12.250629] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00000292 > I suspect the issue is due to commit 72c43f7d6562cec138536e7e6d0939692ff74482 and something like the following should address it: --- diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c index 08d990ba8a79..3081508d030c 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c @@ -1330,7 +1330,7 @@ void iwl_dbg_tlv_init_cfg(struct iwl_fw_runtime *fwrt) u32 reg_type; if (!*active_reg) { - fwrt->trans->dbg.unsupported_region_msk |= BIT(i); + fwrt->trans->dbg.unsupported_region_msk |= BIT_ULL(i); continue; }