From: Jouni Malinen Date: Thu, 30 Sep 2021 15:27:37 +0000 (+0300) Subject: P2P: Make p2p_check_pref_chan_no_recv() easier for static analyzers X-Git-Tag: hostap_2_10~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afa0b9b6c56491cb9bfdbf4911b0f5f6f6fa7b95;p=thirdparty%2Fhostap.git 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 --- diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c index 113346141..1d53d52f1 100644 --- a/src/p2p/p2p_go_neg.c +++ b/src/p2p/p2p_go_neg.c @@ -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;