Skip to content

Commit f4c737d

Browse files
Junjie650Miriam-Rachel
authored andcommitted
wifi: iwlwifi: fix aux ROC time event iterator usage
The list_for_each_entry() iterator must not be used outside the loop. Even though we break and check for NULL, doing so still violates kernel iteration rules and triggers Coccinelle's use_after_iter.cocci warning. Cache the matched entry in aux_roc_te and use it consistently after the loop. This follows iterator best practices, resolves the warning, and makes the code more maintainable. Signed-off-by: Junjie Cao <junjie.cao@intel.com> Link: https://patch.msgid.link/20251016014919.383565-1-junjie.cao@intel.com Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
1 parent c4e1ac0 commit f4c737d

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/net/wireless/intel/iwlwifi/mvm/time-event.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ static int iwl_mvm_aux_roc_te_handle_notif(struct iwl_mvm *mvm,
463463
if (!aux_roc_te) /* Not a Aux ROC time event */
464464
return -EINVAL;
465465

466-
iwl_mvm_te_check_trigger(mvm, notif, te_data);
466+
iwl_mvm_te_check_trigger(mvm, notif, aux_roc_te);
467467

468468
IWL_DEBUG_TE(mvm,
469469
"Aux ROC time event notification - UID = 0x%x action %d (error = %d)\n",
@@ -475,14 +475,14 @@ static int iwl_mvm_aux_roc_te_handle_notif(struct iwl_mvm *mvm,
475475
/* End TE, notify mac80211 */
476476
ieee80211_remain_on_channel_expired(mvm->hw);
477477
iwl_mvm_roc_finished(mvm); /* flush aux queue */
478-
list_del(&te_data->list); /* remove from list */
479-
te_data->running = false;
480-
te_data->vif = NULL;
481-
te_data->uid = 0;
482-
te_data->id = TE_MAX;
478+
list_del(&aux_roc_te->list); /* remove from list */
479+
aux_roc_te->running = false;
480+
aux_roc_te->vif = NULL;
481+
aux_roc_te->uid = 0;
482+
aux_roc_te->id = TE_MAX;
483483
} else if (le32_to_cpu(notif->action) == TE_V2_NOTIF_HOST_EVENT_START) {
484484
set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status);
485-
te_data->running = true;
485+
aux_roc_te->running = true;
486486
ieee80211_ready_on_channel(mvm->hw); /* Start TE */
487487
} else {
488488
IWL_DEBUG_TE(mvm,

0 commit comments

Comments
 (0)