Baochen Qiang
189d7aae8f
wifi: ath12k: fix reusing outside iterator in ath12k_wow_vif_set_wakeups()
Smatch throws below warning:
drivers/net/wireless/ath/ath12k/wow.c:434 ath12k_wow_vif_set_wakeups()
warn: reusing outside iterator: 'i'
drivers/net/wireless/ath/ath12k/wow.c
411 default:
412 break;
413 }
414
415 for (i = 0; i < wowlan->n_patterns; i++) {
^^^^^^^^^^^^^^^^^^^^^^
Here we loop until ->n_patterns
416 const struct cfg80211_pkt_pattern *eth_pattern = &patterns[i];
417 struct ath12k_pkt_pattern new_pattern = {};
418
419 if (WARN_ON(eth_pattern->pattern_len > WOW_MAX_PATTERN_SIZE))
420 return -EINVAL;
421
422 if (ar->ab->wow.wmi_conf_rx_decap_mode ==
423 ATH12K_HW_TXRX_NATIVE_WIFI) {
424 ath12k_wow_convert_8023_to_80211(ar, eth_pattern,
425 &new_pattern);
426
427 if (WARN_ON(new_pattern.pattern_len > WOW_MAX_PATTERN_SIZE))
428 return -EINVAL;
429 } else {
430 memcpy(new_pattern.pattern, eth_pattern->pattern,
431 eth_pattern->pattern_len);
432
433 /* convert bitmask to bytemask */
--> 434 for (i = 0; i < eth_pattern->pattern_len; i++)
435 if (eth_pattern->mask[i / 8] & BIT(i % 8))
436 new_pattern.bytemask[i] = 0xff;
This loop re-uses i and the loop ends with i == eth_pattern->pattern_len.
This looks like a bug.
Change to use a new iterator 'j' for the inner loop to fix it.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Fixes: 4a3c212eee ("wifi: ath12k: add basic WoW functionalities")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/d4975b95-9c43-45af-a0ab-80253f18c7f2@stanley.mountain/
Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://patch.msgid.link/20240722033332.6273-1-quic_bqiang@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-07-26 12:33:38 +02:00
..
2024-07-25 10:42:22 -07:00
2024-07-12 11:31:37 +02:00
2024-07-19 15:55:08 -07:00
2024-07-25 10:42:22 -07:00
2024-07-21 17:15:46 -07:00
2024-07-19 11:57:55 -07:00
2024-07-25 10:42:22 -07:00
2024-07-24 20:59:29 +02:00
2024-07-24 20:59:29 +02:00
2024-07-19 12:16:28 -07:00
2024-07-12 16:07:06 +02:00
2024-07-19 15:55:08 -07:00
2024-07-16 15:54:03 -07:00
2024-07-20 12:41:03 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-10 15:38:14 +02:00
2024-07-25 10:42:22 -07:00
2024-07-21 17:15:46 -07:00
2024-07-15 19:53:07 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 12:55:21 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-19 15:55:08 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-19 15:55:08 -07:00
2024-07-19 09:59:58 -07:00
2024-07-25 10:42:22 -07:00
2024-07-19 15:55:08 -07:00
2024-07-19 11:57:55 -07:00
2024-07-22 14:02:19 -07:00
2024-07-25 08:05:05 -07:00
2024-07-17 17:51:30 -07:00
2024-07-25 12:58:36 -07:00
2024-07-19 21:25:23 -05:00
2024-07-25 10:42:22 -07:00
2024-07-22 11:32:05 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-20 11:52:17 -07:00
2024-07-26 12:33:38 +02:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-22 11:04:09 -07:00
2024-07-25 10:42:22 -07:00
2024-07-19 09:59:58 -07:00
2024-07-15 18:55:14 +02:00
2024-07-25 12:58:36 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-24 20:59:29 +02:00
2024-07-24 13:11:28 -07:00
2024-07-21 10:25:59 -07:00
2024-07-25 10:42:22 -07:00
2024-07-23 09:38:27 -07:00
2024-07-25 10:42:22 -07:00
2024-07-16 19:28:34 -07:00
2024-07-11 15:44:40 +02:00
2024-07-15 18:20:24 -07:00
2024-07-17 17:42:20 -07:00
2024-07-23 13:41:59 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-10 17:15:33 +02:00
2024-07-25 10:42:22 -07:00
2024-07-11 15:42:03 +02:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-18 13:35:55 +02:00
2024-07-25 10:42:22 -07:00
2024-07-25 13:18:41 -07:00
2024-07-19 10:56:58 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00
2024-07-19 11:57:55 -07:00
2024-07-21 17:15:46 -07:00
2024-07-20 12:41:03 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:18:35 -07:00
2024-07-25 10:42:22 -07:00
2024-07-25 10:42:22 -07:00