]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Avoid dead code with P2P not enabled
authorPhilippe De Swert <philippe.deswert@jollamobile.com>
Tue, 23 Sep 2014 07:08:30 +0000 (10:08 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 28 Sep 2014 17:47:06 +0000 (20:47 +0300)
In case P2P is not enabled the if (dev_addr) is always ignored as
dev_addr will be NULL. As this code is relevant only to P2P, it can be
moved to be the ifdef to avoid static analyzer warnings. (CID 72907)

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
src/ap/sta_info.c

index 60f07682ec69fe97609a4602c4ed31fc3c1e5d22..efd2a7243283daaf76e92b256bf234cbd2818211 100644 (file)
@@ -956,12 +956,12 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
                        dev_addr = addr;
        } else
                dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr);
-#endif /* CONFIG_P2P */
 
        if (dev_addr)
                os_snprintf(buf, sizeof(buf), MACSTR " p2p_dev_addr=" MACSTR,
                            MAC2STR(sta->addr), MAC2STR(dev_addr));
        else
+#endif /* CONFIG_P2P */
                os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr));
 
        if (authorized) {