From d5a9331f97274bce991d771fa8a50a5e51fd6428 Mon Sep 17 00:00:00 2001 From: Sreeramya Soratkal Date: Fri, 11 Feb 2022 19:14:04 +0530 Subject: [PATCH] P2P: Copy only valid opclasses while filtering out 6 GHz channels Copy channels from only valid operating classes in the source channel list while preparing a non-6 GHz channel/op-classes list when the 6 GHz band is not used for P2P GO negotiation. Earlier, during preparation of P2P channels for GO negotiation, a union of the GO channels and the P2P Client channels is used. While generating the union in p2p_channels_union_inplace() as the first list itself has P2P_MAX_REG_CLASSES number of entries, the operating classes from the second list which are not in the first list were not getting considered. Fix this by not setting the dst->reg_classes to too large a value. Fixes: f7d4f1cbec34 ("P2P: Add a mechanism for allowing 6 GHz channels in channel lists") Signed-off-by: Sreeramya Soratkal --- src/p2p/p2p_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p2p/p2p_utils.c b/src/p2p/p2p_utils.c index 7d21f6881..a20360633 100644 --- a/src/p2p/p2p_utils.c +++ b/src/p2p/p2p_utils.c @@ -508,7 +508,7 @@ void p2p_copy_channels(struct p2p_channels *dst, return; } - for (i = 0, j = 0; i < P2P_MAX_REG_CLASSES; i++) { + for (i = 0, j = 0; i < src->reg_classes; i++) { if (is_6ghz_op_class(src->reg_class[i].reg_class)) continue; os_memcpy(&dst->reg_class[j], &src->reg_class[i], -- 2.47.3