MLD STA: Fully clear MLO info to avoid use of uninitialized members

The initial wpa_drv_get_mlo_info() implementation cleared only the
valid_links information within struct driver_sta_mlo_info before trying
to fetch the information from the driver. While this is likely going to
work fine in practice, this can result in static analyzer warnings on
use of uninitialized memory (e.g., mlo.assoc_link_id could have been
read if wpa_s->valid_links was set to a nonzero value). In any case, it
is better to avoid such unnecessary warnings by clearing the full data
structure before using it.

Fixes: 7784964cbe ("MLD STA: Fetch MLO connection info into core wpa_supplicant")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2022-11-02 11:56:46 +02:00 committed by Jouni Malinen
parent 496a1ced16
commit 90cef4f211

View file

@ -3360,7 +3360,7 @@ static int wpa_drv_get_mlo_info(struct wpa_supplicant *wpa_s)
struct driver_sta_mlo_info mlo;
int i;
mlo.valid_links = 0;
os_memset(&mlo, 0, sizeof(mlo));
if (wpas_drv_get_sta_mlo_info(wpa_s, &mlo)) {
wpa_dbg(wpa_s, MSG_ERROR, "Failed to get MLO link info");
wpa_supplicant_deauthenticate(wpa_s,