]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ACS: Be more consistent with iface->current_mode checks
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 7 Jan 2016 14:39:10 +0000 (16:39 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 7 Jan 2016 14:39:10 +0000 (16:39 +0200)
Offloading of ACS to the driver changed the design a bit in a way that
iface->current_mode could actually be NULL when the offloaded ACS
mechanism supports band selection in addition to channel selection. This
resulted in a combination that is too complex for static analyzers to
notice. While acs_init() can be called with iface->current_mode == NULL
that is only in the case where WPA_DRIVER_FLAGS_ACS_OFFLOAD is in use.
In other words, the actual ACS functions like acs_cleanup() that would
dereference iface->current_mode are not used in such a case.

Get rid of static analyzer warnings by explicitly checking
iface->current_mode in acs_init() for the case where ACS offloading is
not used.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/ap/acs.c

index 03d797fe8836a5e63c62d78bb76f5b629f492426..0795af00b2092e87953f9da18461a308c602eab3 100644 (file)
@@ -933,6 +933,9 @@ enum hostapd_chan_status acs_init(struct hostapd_iface *iface)
                return HOSTAPD_CHAN_ACS;
        }
 
+       if (!iface->current_mode)
+               return HOSTAPD_CHAN_INVALID;
+
        acs_cleanup(iface);
 
        err = acs_request_scan(iface);