]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Remove useless NULL comparison for an array
authorJouni Malinen <j@w1.fi>
Sun, 7 Jul 2019 06:58:46 +0000 (09:58 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 7 Jul 2019 07:00:49 +0000 (10:00 +0300)
Now that the TLS peer_cert information is provided as a full struct to
handler functions, the altsubject pointer shows up as an array and
causes static analyzers to warn about unnecessary NULL comparison. Get
rid of that comparison now that it is clearly not needed anymore.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/eapol_test.c
wpa_supplicant/notify.c

index e9412d4155d2ee2868c504d4951503078aaee32c..524724f19735d990664b719a7c6d888f61b2bd9d 100644 (file)
@@ -502,6 +502,7 @@ static void eapol_test_cert_cb(void *ctx, struct tls_cert_data *cert,
                               const char *cert_hash)
 {
        struct eapol_test_data *e = ctx;
+       int i;
 
        wpa_msg(e->wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
                "depth=%d subject='%s'%s%s",
@@ -528,14 +529,9 @@ static void eapol_test_cert_cb(void *ctx, struct tls_cert_data *cert,
                                              cert->subject, cert->cert);
        }
 
-       if (cert->altsubject) {
-               int i;
-
-               for (i = 0; i < cert->num_altsubject; i++)
-                       wpa_msg(e->wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
-                               "depth=%d %s", cert->depth,
-                               cert->altsubject[i]);
-       }
+       for (i = 0; i < cert->num_altsubject; i++)
+               wpa_msg(e->wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
+                       "depth=%d %s", cert->depth, cert->altsubject[i]);
 }
 
 
index dd627d015e06dd85585d73791318b70d8179346c..e41d7c41c61cfb2103f84f5258b8f21bdda73552 100644 (file)
@@ -791,6 +791,8 @@ void wpas_notify_certification(struct wpa_supplicant *wpa_s,
                               struct tls_cert_data *cert,
                               const char *cert_hash)
 {
+       int i;
+
        wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
                "depth=%d subject='%s'%s%s%s",
                cert->depth, cert->subject, cert_hash ? " hash=" : "",
@@ -812,14 +814,9 @@ void wpas_notify_certification(struct wpa_supplicant *wpa_s,
                }
        }
 
-       if (cert->altsubject) {
-               int i;
-
-               for (i = 0; i < cert->num_altsubject; i++)
-                       wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
-                               "depth=%d %s", cert->depth,
-                               cert->altsubject[i]);
-       }
+       for (i = 0; i < cert->num_altsubject; i++)
+               wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
+                       "depth=%d %s", cert->depth, cert->altsubject[i]);
 
        /* notify the new DBus API */
        wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,