aboutsummaryrefslogtreecommitdiffstats
path: root/src/rsn_supp/preauth.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-10-11 14:18:02 (GMT)
committerJouni Malinen <j@w1.fi>2014-10-11 14:18:02 (GMT)
commitf4452cc2b12e61232977a8f1c56dd2f2db702127 (patch)
tree48bc6852154919be0ff230f4719eb7ee13a93222 /src/rsn_supp/preauth.c
parent3e9fa3be62d2f39f4ad997427a0c06a50a8ccea2 (diff)
downloadhostap-f4452cc2b12e61232977a8f1c56dd2f2db702127.zip
hostap-f4452cc2b12e61232977a8f1c56dd2f2db702127.tar.gz
hostap-f4452cc2b12e61232977a8f1c56dd2f2db702127.tar.bz2
Add a workaround to clanc static analyzer warning
dl_list_del() followed by dl_list_add() seemed to confuse clang static analyzer somehow, so explicitly check for the prev pointer to be non-NULL to avoid an incorrect warning. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/rsn_supp/preauth.c')
-rw-r--r--src/rsn_supp/preauth.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rsn_supp/preauth.c b/src/rsn_supp/preauth.c
index 915f85e..0e4f012 100644
--- a/src/rsn_supp/preauth.c
+++ b/src/rsn_supp/preauth.c
@@ -391,6 +391,18 @@ void pmksa_candidate_add(struct wpa_sm *sm, const u8 *bssid,
dl_list_for_each(pos, &sm->pmksa_candidates,
struct rsn_pmksa_candidate, list) {
if (cand->priority <= pos->priority) {
+ if (!pos->list.prev) {
+ /*
+ * This cannot really happen in pracrice since
+ * pos was fetched from the list and the prev
+ * pointer must be set. It looks like clang
+ * static analyzer gets confused with the
+ * dl_list_del(&cand->list) call above and ends
+ * up assuming pos->list.prev could be NULL.
+ */
+ os_free(cand);
+ return;
+ }
dl_list_add(pos->list.prev, &cand->list);
cand = NULL;
break;