Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Nov 2023 16:38:16 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9ceccf808c85 - stable/13 - LinuxKPI: 802.11: fix counting the number of supbands
Message-ID:  <202311291638.3ATGcGKF045408@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=9ceccf808c85808252cf166d2d334f297551a85e

commit 9ceccf808c85808252cf166d2d334f297551a85e
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-09-14 17:57:53 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-11-29 16:36:06 +0000

    LinuxKPI: 802.11: fix counting the number of supbands
    
    While the main purpose was to assign an(y) early chandef with the
    loop, later additions made use of it to also count supbands as well
    as to initialise max_rates.
    Due to the main goal we can exit the loop early and not properly
    count and initialise supbands and max_rates.
    Move the terminating condition into the loop and make it a continue
    rather than ending the loop.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit f454a4a10dc027474a85269cb4a3f50bbbf90528)
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 1931a8528ed5..d0f718ae0dc7 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -3760,8 +3760,7 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw)
 	 * in any band so we can scale [(ext) sup rates] IE(s) accordingly.
 	 */
 	lhw->supbands = lhw->max_rates = 0;
-	for (band = 0; band < NUM_NL80211_BANDS &&
-	    hw->conf.chandef.chan == NULL; band++) {
+	for (band = 0; band < NUM_NL80211_BANDS; band++) {
 		struct ieee80211_supported_band *supband;
 		struct linuxkpi_ieee80211_channel *channels;
 
@@ -3772,6 +3771,10 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw)
 		lhw->supbands++;
 		lhw->max_rates = max(lhw->max_rates, supband->n_bitrates);
 
+		/* If we have a channel, we need to keep counting supbands. */
+		if (hw->conf.chandef.chan != NULL)
+			continue;
+
 		channels = supband->channels;
 		for (i = 0; i < supband->n_channels; i++) {
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202311291638.3ATGcGKF045408>