($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 1/2] wiphy: fix wiphy_contrain_freq_set skipping last channel
Date: Tue, 19 Sep 2023 09:59:22 -0700	[thread overview]
Message-ID: <20230919165923.1352279-1-prestwoj@gmail.com> (raw)

The loop iterating the frequency attributes list was not including
the entire channel set since it was stopping at i < band->freqs_len.
The freq_attrs array is allocated to include the last channel:

band->freq_attrs = l_new(struct band_freq_attrs, num_channels + 1);
band->freqs_len = num_channels;

So instead the for loop should use i <= band->freqs_len. (I also
changed this to start the loop at 1 since channel zero is invalid).
---
 src/wiphy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/wiphy.c b/src/wiphy.c
index 77ed2acf..ccff701e 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -843,7 +843,7 @@ bool wiphy_constrain_freq_set(const struct wiphy *wiphy,
 		if (!band)
 			continue;
 
-		for (i = 0; i < band->freqs_len; i++) {
+		for (i = 1; i <= band->freqs_len; i++) {
 			uint32_t freq;
 
 			if (!band->freq_attrs[i].supported)
-- 
2.25.1


             reply	other threads:[~2023-09-19 16:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19 16:59 James Prestwood [this message]
2023-09-19 16:59 ` [PATCH 2/2] unit: include frequency 7115 in test-band James Prestwood
2023-09-25 14:30 ` [PATCH 1/2] wiphy: fix wiphy_contrain_freq_set skipping last channel Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230919165923.1352279-1-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).