]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Make get_mode() easier for static analyzers
authorJouni Malinen <jouni@codeaurora.org>
Thu, 30 Sep 2021 15:23:26 +0000 (18:23 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 30 Sep 2021 15:23:26 +0000 (18:23 +0300)
Add an explicit check for modes != NULL instead of depending on
num_modes > 0 implying that. This is to silence invalid static analyzer
reports.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/wpa_supplicant.c

index 1e5f6bcc7ad7aa67d3cb5b4da8aed73dade4df9b..c9d53a3d749bb1aa7160bb314ecaca8c1bd0aed3 100644 (file)
@@ -8232,6 +8232,9 @@ struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
 {
        u16 i;
 
+       if (!modes)
+               return NULL;
+
        for (i = 0; i < num_modes; i++) {
                if (modes[i].mode != mode ||
                    !modes[i].num_channels || !modes[i].channels)