From a95cc47a929cb84bfc47497118f1f032043c1502 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 7 Jan 2016 16:39:10 +0200 Subject: [PATCH] ACS: Be more consistent with iface->current_mode checks 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 --- src/ap/acs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ap/acs.c b/src/ap/acs.c index 03d797fe8..0795af00b 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -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);