[PATCH 4/5] DFS: fix range availability check

Eliad Peller eliad at wizery.com
Thu Mar 19 10:41:42 EDT 2015


There's off-by-one in the range availability check - the
case of first_chan_idx + nun_chans == num_channels should
be allowed (e.g. 0 + 1 == 1, for the case of a single
20mhz channel)

Signed-off-by: Maital Hahn <maitalm at ti.com>
Signed-off-by: Eliad Peller <eliad at wizery.com>
---
 src/ap/dfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index b11cada..f773166 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -140,7 +140,7 @@ static int dfs_chan_range_available(struct hostapd_hw_modes *mode,
 	struct hostapd_channel_data *first_chan, *chan;
 	int i;
 
-	if (first_chan_idx + num_chans >= mode->num_channels)
+	if (first_chan_idx + num_chans > mode->num_channels)
 		return 0;
 
 	first_chan = &mode->channels[first_chan_idx];
-- 
1.8.5.2.229.g4448466.dirty



More information about the HostAP mailing list