knownnetworks: update known frequencies maximum to 7115
James Prestwood
PATCH 1/1 knownnetworks: update known frequencies maximum to 7115
With the addition of 6GHz '6000' is no longer the maximum frequency that could be in .known_network.freq.
--- src/knownnetworks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/knownnetworks.c +1 -1
@@ -856,7 +856,7 @@ static struct l_queue *known_frequencies_from_string(char *freq_set_str) t =strtoul (freq_set_str, &freq_set_str,10 ); -if (unlikely (errno ==ERANGE || !t || t >6000 )) +if (unlikely (errno ==ERANGE || !t || t >7115 )) goto error; known_freq = l_new(struct known_frequency, 1);
Signature · 1 line
2.34.1
Diederik de Haas
src/knownnetworks.c static struct l_queue *known_frequencies_from_string(char *freq_set_str) · line 859
Quoted 2 lines · On Thursday, 3 March 2022 18:22:34 CET James Prestwood wrote:
src/knownnetworks.c +1
-1-if (unlikely (errno ==ERANGE || !t || t >6000 )) +if (unlikely (errno ==ERANGE || !t || t >7115 ))
Sorry if this is a dumb comment, but why use a 'magic number' [1] (which meaning can be derived from the git commit comment, but not when just looking at the source)?
James Prestwood
Quoted 9 lines · Diederik de Haas
Quoted 2 lines · On Thursday, 3 March 2022 18:22:34 CET James Prestwood wrote:
- if (unlikely(errno == ERANGE || !t || t > 6000)) + if (unlikely(errno == ERANGE || !t || t > 7115))Sorry if this is a dumb comment, but why use a 'magic number' [1] (which
meaning can be derived from the git commit comment, but not when just looking
at the source)?
I'm not sure if we have a style/rule about this but I think generally if the value is only used once, and its clear what it is, a macro may not be required.
*waits for angry mob*
Denis' recommendation solves a few potential issues in addition to just updating, including the hard coded value.
Quoted 2 lines
Denis Kenzior
Hi James,
Quoted 11 lines · James Prestwood
With the addition of 6GHz '6000' is no longer the maximum frequency that could be in .known_network.freq.
--- src/knownnetworks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/knownnetworks.c +0
-0
src/knownnetworks.c static struct l_queue *known_frequencies_from_string(char *freq_set_str) · line 859
Quoted 5 lines
src/knownnetworks.c +1
-1@@ -856,7 +856,7 @@ static struct l_queue *known_frequencies_from_string(char *freq_set_str) t =strtoul (freq_set_str, &freq_set_str,10 ); -if (unlikely (errno ==ERANGE || !t || t >6000 )) +if (unlikely (errno ==ERANGE || !t || t >7115 ))
Do you want to use band_freq_to_channel here instead? That one checks the valid freqs...
src/knownnetworks.c static struct l_queue *known_frequencies_from_string(char *freq_set_str) · line 862
Quoted 4 lines
src/knownnetworks.c +0
-0goto error; known_freq = l_new(struct known_frequency, 1);
Regards,
-Denis