git: 35a61e071b84 - releng/14.0 - iwlwifi: fix a bug in iwl_ssid_exist()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 09 Oct 2023 23:16:11 UTC
The branch releng/14.0 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=35a61e071b84eb6a3969ffd796c73399e0555e13

commit 35a61e071b84eb6a3969ffd796c73399e0555e13
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-09-14 17:22:04 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-10-09 23:14:52 +0000

    iwlwifi: fix a bug in iwl_ssid_exist()
    
    Rather than always comparing a given SSID to the first SSID of the
    IE list, compare it to the the iterator one.  That way duplicates can
    be found.
    
    Sponsored by:   The FreeBSD Foundation
    Approved by:    re (gjb)
    
    (cherry picked from commit ee7077f24f5b02bde8cf5c202848128f18733398)
    (cherry picked from commit a513f65b92b672830c89acfa04b93c3b77d3f97d)
---
 sys/contrib/dev/iwlwifi/mvm/scan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/contrib/dev/iwlwifi/mvm/scan.c b/sys/contrib/dev/iwlwifi/mvm/scan.c
index a4077053e374..8c5d6860914b 100644
--- a/sys/contrib/dev/iwlwifi/mvm/scan.c
+++ b/sys/contrib/dev/iwlwifi/mvm/scan.c
@@ -447,7 +447,11 @@ static int iwl_ssid_exist(u8 *ssid, u8 ssid_len, struct iwl_ssid_ie *ssid_list)
 		if (!ssid_list[i].len)
 			break;
 		if (ssid_list[i].len == ssid_len &&
+#if defined(__linux__)
 		    !memcmp(ssid_list->ssid, ssid, ssid_len))
+#elif defined(__FreeBSD__)
+		    !memcmp(ssid_list[i].ssid, ssid, ssid_len))
+#endif
 			return i;
 	}
 	return -1;