P2P: Make p2p_check_pref_chan_no_recv() easier for static analyzers

Add an explicit check for msg->channel_list != NULL instead of depending
on msg->channel_list_len > 0 implying that. This is to silence invalid
static analyzer reports.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2021-09-30 18:27:37 +03:00 committed by Jouni Malinen
parent 857c4dfa83
commit afa0b9b6c5

View file

@ -582,8 +582,8 @@ static void p2p_check_pref_chan_no_recv(struct p2p_data *p2p, int go,
&op_channel) < 0)
continue; /* cannot happen due to earlier check */
for (j = 0; j < msg->channel_list_len; j++) {
if (op_channel != msg->channel_list[j])
if (!msg->channel_list ||
op_channel != msg->channel_list[j])
continue;
p2p->op_reg_class = op_class;