Patch "wifi: brcmfmac: Adjust n_channels usage for __counted_by" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    wifi: brcmfmac: Adjust n_channels usage for __counted_by

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     wifi-brcmfmac-adjust-n_channels-usage-for-__counted_.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0d12eb9ea7f6c5d195ac33ddb385ae9eefa4b699
Author: Kees Cook <keescook@xxxxxxxxxxxx>
Date:   Fri Jan 26 14:31:53 2024 -0800

    wifi: brcmfmac: Adjust n_channels usage for __counted_by
    
    [ Upstream commit 5bdda0048c8d1bbe2019513b2d6200cc0d09c7bd ]
    
    After commit e3eac9f32ec0 ("wifi: cfg80211: Annotate struct
    cfg80211_scan_request with __counted_by"), the compiler may enforce
    dynamic array indexing of req->channels to stay below n_channels. As a
    result, n_channels needs to be increased _before_ accessing the newly
    added array index. Increment it first, then use "i" for the prior index.
    Solves this warning in the coming GCC that has __counted_by support:
    
    ../drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function 'brcmf_internal_escan_add_info':
    ../drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3783:46: warning: operation on 'req->
    n_channels' may be undefined [-Wsequence-point]
     3783 |                 req->channels[req->n_channels++] = chan;
          |                               ~~~~~~~~~~~~~~~^~
    
    Fixes: e3eac9f32ec0 ("wifi: cfg80211: Annotate struct cfg80211_scan_request with __counted_by")
    Cc: Arend van Spriel <aspriel@xxxxxxxxx>
    Cc: Franky Lin <franky.lin@xxxxxxxxxxxx>
    Cc: Hante Meuleman <hante.meuleman@xxxxxxxxxxxx>
    Cc: Kalle Valo <kvalo@xxxxxxxxxx>
    Cc: Chi-hsien Lin <chi-hsien.lin@xxxxxxxxxxxx>
    Cc: Ian Lin <ian.lin@xxxxxxxxxxxx>
    Cc: Johannes Berg <johannes.berg@xxxxxxxxx>
    Cc: Wright Feng <wright.feng@xxxxxxxxxxx>
    Cc: Hector Martin <marcan@xxxxxxxxx>
    Cc: linux-wireless@xxxxxxxxxxxxxxx
    Cc: brcm80211-dev-list.pdl@xxxxxxxxxxxx
    Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Reviewed-by: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>
    Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxx>
    Link: https://msgid.link/20240126223150.work.548-kees@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 2a90bb24ba77..6049f9a761d9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -3780,8 +3780,10 @@ static int brcmf_internal_escan_add_info(struct cfg80211_scan_request *req,
 		if (req->channels[i] == chan)
 			break;
 	}
-	if (i == req->n_channels)
-		req->channels[req->n_channels++] = chan;
+	if (i == req->n_channels) {
+		req->n_channels++;
+		req->channels[i] = chan;
+	}
 
 	for (i = 0; i < req->n_ssids; i++) {
 		if (req->ssids[i].ssid_len == ssid_len &&




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux