0061-wifi-ath11k-fix-undefined-behavior-with-__fls-in-dp.patch 1.1 KB

1234567891011121314151617181920212223242526272829
  1. From 41e02bf4ae32cf2ac47b08b4caaa9c1a032e4ce7 Mon Sep 17 00:00:00 2001
  2. From: Harshitha Prem <quic_hprem@quicinc.com>
  3. Date: Tue, 4 Apr 2023 00:11:55 +0530
  4. Subject: [PATCH] wifi: ath11k: fix undefined behavior with __fls in dp
  5. "__fls" would have an undefined behavior if the argument is passed
  6. as "0". Hence, added changes to handle the same.
  7. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
  8. Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
  9. Signed-off-by: Nagarajan Maran <quic_nmaran@quicinc.com>
  10. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
  11. Link: https://lore.kernel.org/r/20230403184155.8670-3-quic_nmaran@quicinc.com
  12. ---
  13. drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +-
  14. 1 file changed, 1 insertion(+), 1 deletion(-)
  15. --- a/drivers/net/wireless/ath/ath11k/dp_rx.c
  16. +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
  17. @@ -3598,7 +3598,7 @@ static int ath11k_dp_rx_frag_h_mpdu(stru
  18. goto out_unlock;
  19. }
  20. - if (frag_no > __fls(rx_tid->rx_frag_bitmap))
  21. + if (!rx_tid->rx_frag_bitmap || (frag_no > __fls(rx_tid->rx_frag_bitmap)))
  22. __skb_queue_tail(&rx_tid->rx_frags, msdu);
  23. else
  24. ath11k_dp_rx_h_sort_frags(ar, &rx_tid->rx_frags, msdu);