From: Adrian Bunk Date: Mon, 20 Mar 2006 03:21:45 +0000 (-0800) Subject: [PATCH] hostap: Fix ap_add_sta() return value verification X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=54b85f489bdfafc9306dfcc21e0d2687c34c3b34;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [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: Adrian Bunk Signed-off-by: Jouni Malinen Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index 753a1de6664b..06c3fa32b310 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c @@ -3141,7 +3141,7 @@ int hostap_add_sta(struct ap_data *ap, u8 *sta_addr) if (ret == 1) { sta = ap_add_sta(ap, sta_addr); if (!sta) - ret = -1; + return -1; sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC; sta->ap = 1; memset(sta->supported_rates, 0, sizeof(sta->supported_rates));