From afa0b9b6c56491cb9bfdbf4911b0f5f6f6fa7b95 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 30 Sep 2021 18:27:37 +0300 Subject: [PATCH] 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 --- src/p2p/p2p_go_neg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;