提交 54b85f48 编写于 作者: A Adrian Bunk 提交者: John W. Linville

[PATCH] hostap: Fix ap_add_sta() return value verification

The Coverity checker (CID: 273) spotted this inconsequent NULL checking
(unconditionally dereferencing directly after checking for NULL
isn't a good idea). Return immediately to avoid this.
Signed-off-by: NAdrian Bunk <bunk@stusta.de>
Signed-off-by: NJouni Malinen <jkmaline@cc.hut.fi>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 971d1e69
...@@ -3141,7 +3141,7 @@ int hostap_add_sta(struct ap_data *ap, u8 *sta_addr) ...@@ -3141,7 +3141,7 @@ int hostap_add_sta(struct ap_data *ap, u8 *sta_addr)
if (ret == 1) { if (ret == 1) {
sta = ap_add_sta(ap, sta_addr); sta = ap_add_sta(ap, sta_addr);
if (!sta) if (!sta)
ret = -1; return -1;
sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC; sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC;
sta->ap = 1; sta->ap = 1;
memset(sta->supported_rates, 0, sizeof(sta->supported_rates)); memset(sta->supported_rates, 0, sizeof(sta->supported_rates));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册