All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ie: fix static analysis warning
@ 2021-05-14 15:36 James Prestwood
  0 siblings, 0 replies; only message in thread
From: James Prestwood @ 2021-05-14 15:36 UTC (permalink / raw
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

The supp_rates_iter was being used prior to the NULL check. This
was fixed as well as some reordering to make the function consistent
between supp_rates_iter and ext_supp_rates_iter.
---
 src/ie.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/ie.c b/src/ie.c
index 0b471f1b..352ce469 100644
--- a/src/ie.c
+++ b/src/ie.c
@@ -1673,11 +1673,6 @@ static int ie_parse_supported_rates(struct ie_tlv_iter *supp_rates_iter,
 	unsigned int len;
 	unsigned int i;
 
-	len = ie_tlv_iter_get_length(supp_rates_iter);
-
-	if (len == 0)
-		return -EINVAL;
-
 	/* Find highest rates possible with our RSSI */
 	for (i = 0; i < L_ARRAY_SIZE(rate_rssi_map); i++) {
 		const struct basic_rate_map *map = &rate_rssi_map[i];
@@ -1688,8 +1683,9 @@ static int ie_parse_supported_rates(struct ie_tlv_iter *supp_rates_iter,
 		max_rate = map->rate;
 	}
 
+	/* Find highest rate in Supported Rates IE */
 	if (supp_rates_iter) {
-		/* Find highest rate in Supported Rates IE */
+		len = ie_tlv_iter_get_length(supp_rates_iter);
 		rates = ie_tlv_iter_get_data(supp_rates_iter);
 
 		for (i = 0; i < len; i++) {
-- 
2.31.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-14 15:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-14 15:36 [PATCH] ie: fix static analysis warning James Prestwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.