]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Make p2p_check_pref_chan_no_recv() easier for static analyzers
authorJouni Malinen <jouni@codeaurora.org>
Thu, 30 Sep 2021 15:27:37 +0000 (18:27 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 30 Sep 2021 15:27:37 +0000 (18:27 +0300)
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>
src/p2p/p2p_go_neg.c

index 1133461419864ec59dd3a5e4367f7ffae99af7f9..1d53d52f1f8e7d92837c57baf7f406e2ed6d1baf 100644 (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;