Skip to contentSkip to conversation

drivers/net/wireless/intel/iwlwifi/mvm/d3.c:2499 iwl_mvm_parse_wowlan_info_notif() warn: variable dereferenced before check 'data' (see line 2497)

PATCH kernel test robot 1 participant 1 message Nov 21, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

BCC: [email protected]
CC: [email protected]
TO: Emmanuel Grumbach <[email protected]>
CC: Johannes Berg <[email protected]>
CC: Miri Korenblit <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ac24e26aa08fe026804f678599f805eb13374a5d
commit: 4635e6eaa0fec321409242f99cccedbaf486c5e8 [9320/12380] wifi: iwlwifi: mvm: support new versions of the wowlan APIs

:::::: branch date: 18 hours ago
:::::: commit date: 13 days ago
config: i386-randconfig-141-20241120 (https://download.01.org/0day-ci/archive/20241121/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
drivers/net/wireless/intel/iwlwifi/mvm/d3.c:2499 iwl_mvm_parse_wowlan_info_notif() warn: variable dereferenced before check 'data' (see line 2497)

vim +/data +2499 drivers/net/wireless/intel/iwlwifi/mvm/d3.c

0c4aa7a12a5a96 Yedidya Benshimol 2023-09-21  2490  
32fed4706d9aca Naftali Goldstein 2022-09-06  2491  static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm,
32fed4706d9aca Naftali Goldstein 2022-09-06  2492  					    struct iwl_wowlan_info_notif *data,
32fed4706d9aca Naftali Goldstein 2022-09-06  2493  					    struct iwl_wowlan_status_data *status,
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2494  					    u32 len)
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2495  {
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2496  	u32 expected_len = sizeof(*data) +
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28 @2497  		data->num_mlo_link_keys * sizeof(status->mlo_keys[0]);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2498  
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28 @2499  	if (!data) {
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2500  		IWL_ERR(mvm, "iwl_wowlan_info_notif data is NULL\n");
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2501  		status = NULL;
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2502  		return;
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2503  	}
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2504  
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2505  	if (len < expected_len) {
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2506  		IWL_ERR(mvm, "Invalid WoWLAN info notification!\n");
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2507  		status = NULL;
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2508  		return;
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2509  	}
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2510  
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2511  	if (mvm->fast_resume)
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2512  		return;
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2513  
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2514  	iwl_mvm_convert_key_counters_v5(status, &data->gtk[0].sc);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2515  	iwl_mvm_convert_gtk_v3(status, data->gtk);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2516  	iwl_mvm_convert_igtk(status, &data->igtk[0]);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2517  	iwl_mvm_convert_bigtk(status, data->bigtk);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2518  	status->replay_ctr = le64_to_cpu(data->replay_ctr);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2519  	status->pattern_number = le16_to_cpu(data->pattern_number);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2520  	status->tid_offloaded_tx = data->tid_offloaded_tx;
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2521  	if (IWL_FW_CHECK(mvm,
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2522  			 data->tid_offloaded_tx >=
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2523  			 ARRAY_SIZE(status->qos_seq_ctr),
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2524  			 "tid_offloaded_tx is out of bound %d\n",
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2525  			 data->tid_offloaded_tx))
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2526  		data->tid_offloaded_tx = 0;
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2527  	status->qos_seq_ctr[data->tid_offloaded_tx] =
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2528  		le16_to_cpu(data->qos_seq_ctr);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2529  	status->wakeup_reasons = le32_to_cpu(data->wakeup_reasons);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2530  	status->num_of_gtk_rekeys =
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2531  		le32_to_cpu(data->num_of_gtk_rekeys);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2532  	status->received_beacons = le32_to_cpu(data->received_beacons);
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2533  	status->tid_tear_down = data->tid_tear_down;
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2534  
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2535  	if (data->num_mlo_link_keys) {
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2536  		status->num_mlo_keys = data->num_mlo_link_keys;
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2537  		if (IWL_FW_CHECK(mvm,
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2538  				 status->num_mlo_keys > WOWLAN_MAX_MLO_KEYS,
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2539  				 "Too many mlo keys: %d, max %d\n",
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2540  				 status->num_mlo_keys, WOWLAN_MAX_MLO_KEYS))
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2541  			status->num_mlo_keys = WOWLAN_MAX_MLO_KEYS;
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2542  		memcpy(status->mlo_keys, data->mlo_gtks,
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2543  		       status->num_mlo_keys * sizeof(status->mlo_keys[0]));
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2544  	}
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2545  }
4635e6eaa0fec3 Emmanuel Grumbach 2024-10-28  2546  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki