git: ee7077f24f5b - main - iwlwifi: fix a bug in iwl_ssid_exist()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Thu, 14 Sep 2023 21:21:10 UTC
The branch main has been updated by bz:

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

commit ee7077f24f5b02bde8cf5c202848128f18733398
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-09-14 17:22:04 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-09-14 21:20:54 +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
    MFC after:      3 days
---
 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;