From bd567cf04605e8099cc06fa243df74dcf6704584 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Thu, 2 Jul 2026 07:55:13 +0530 Subject: [PATCH] fix(wpa_supplicant): fix unused-but-set-variable warnings with GCC 16 GCC 16 raised the default level of -Wunused-but-set-variable and now flags variables that are only used to update themselves. Remove the 'removed' counter in pmksa_cache_flush() (its only read was commented out) and mark the EAP-FAST PAC entry counters as unused, since their only read is inside wpa_printf(MSG_DEBUG, ...) which compiles to a no-op when debug logging is disabled. --- .../wpa_supplicant/src/eap_peer/eap_fast_pac.c | 15 +++++++++++---- .../wpa_supplicant/src/rsn_supp/pmksa_cache.c | 4 ---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/components/wpa_supplicant/src/eap_peer/eap_fast_pac.c b/components/wpa_supplicant/src/eap_peer/eap_fast_pac.c index 940eeb7f813..70bac4bdf0f 100644 --- a/components/wpa_supplicant/src/eap_peer/eap_fast_pac.c +++ b/components/wpa_supplicant/src/eap_peer/eap_fast_pac.c @@ -414,7 +414,8 @@ int eap_fast_load_pac(struct eap_sm *sm, struct eap_fast_pac **pac_root, { struct eap_fast_read_ctx rc; struct eap_fast_pac *pac = NULL; - int count = 0; + /* count is only consumed by debug logging */ + int count __attribute__((unused)) = 0; char *pos; const char *err = NULL; @@ -623,7 +624,9 @@ int eap_fast_save_pac(struct eap_sm *sm, struct eap_fast_pac *pac_root, const char *pac_file) { struct eap_fast_pac *pac; - int ret, count = 0; + int ret; + /* count is only consumed by debug logging */ + int count __attribute__((unused)) = 0; char *buf, *pos; size_t buf_len; @@ -754,7 +757,9 @@ int eap_fast_load_pac_bin(struct eap_sm *sm, struct eap_fast_pac **pac_root, { const struct wpa_config_blob *blob = NULL; u8 *buf, *end, *pos; - size_t len, count = 0; + size_t len; + /* count is only consumed by debug logging */ + size_t count __attribute__((unused)) = 0; struct eap_fast_pac *pac, *prev; *pac_root = NULL; @@ -876,7 +881,9 @@ parse_fail: int eap_fast_save_pac_bin(struct eap_sm *sm, struct eap_fast_pac *pac_root, const char *pac_file) { - size_t len, count = 0; + size_t len; + /* count is only consumed by debug logging */ + size_t count __attribute__((unused)) = 0; struct eap_fast_pac *pac; u8 *buf, *pos; diff --git a/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c b/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c index 710de74ef17..584e8a7a8ff 100644 --- a/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c +++ b/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c @@ -280,7 +280,6 @@ void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx, const u8 *pmk, size_t pmk_len) { struct rsn_pmksa_cache_entry *entry, *prev = NULL, *tmp; - int removed = 0; entry = pmksa->pmksa; while (entry) { @@ -298,14 +297,11 @@ void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx, tmp = entry; entry = entry->next; pmksa_cache_free_entry(pmksa, tmp, PMKSA_FREE); - removed++; } else { prev = entry; entry = entry->next; } } - /*if (removed) - pmksa_cache_set_expiration(pmksa);*/ }