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.
This commit is contained in:
Mahavir Jain
2026-07-02 07:55:13 +05:30
parent 0daee142a3
commit bd567cf046
2 changed files with 11 additions and 8 deletions
@@ -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;
@@ -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);*/
}