DPP2: Check conn->ctrl more consistently

There is no point in checking this pointer against NULL after it has
been dereferenced. Move the check to the beginning of the function.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-04-28 20:28:46 +03:00
parent d42df8d6ce
commit b93a0ce7bd

View File

@ -9332,6 +9332,9 @@ static int dpp_controller_rx_auth_req(struct dpp_connection *conn,
u16 r_bootstrap_len, i_bootstrap_len; u16 r_bootstrap_len, i_bootstrap_len;
struct dpp_bootstrap_info *own_bi = NULL, *peer_bi = NULL; struct dpp_bootstrap_info *own_bi = NULL, *peer_bi = NULL;
if (!conn->ctrl)
return 0;
wpa_printf(MSG_DEBUG, "DPP: Authentication Request"); wpa_printf(MSG_DEBUG, "DPP: Authentication Request");
r_bootstrap = dpp_get_attr(buf, len, DPP_ATTR_R_BOOTSTRAP_KEY_HASH, r_bootstrap = dpp_get_attr(buf, len, DPP_ATTR_R_BOOTSTRAP_KEY_HASH,
@ -9379,8 +9382,7 @@ static int dpp_controller_rx_auth_req(struct dpp_connection *conn,
return -1; return -1;
} }
if (conn->ctrl && if (dpp_set_configurator(conn->ctrl->global, conn->ctrl->global->msg_ctx,
dpp_set_configurator(conn->ctrl->global, conn->ctrl->global->msg_ctx,
conn->auth, conn->auth,
conn->ctrl->configurator_params) < 0) { conn->ctrl->configurator_params) < 0) {
dpp_connection_remove(conn); dpp_connection_remove(conn);