Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2588320rdb; Fri, 22 Sep 2023 03:10:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHU0mjOCsJHZ8JGyLUV4Q9OM0NZftdRnbtW3lcc6GVPJXlwcbAOdHHf61BQq19jRyh5uJYz X-Received: by 2002:a05:6a20:5492:b0:133:8784:15f7 with SMTP id i18-20020a056a20549200b00133878415f7mr3070913pzk.14.1695377418098; Fri, 22 Sep 2023 03:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695377418; cv=none; d=google.com; s=arc-20160816; b=xSLpMN3wKq65e1z0Z1D31csDwjTw1e4Jtc0BqnTNrJ4mAkSnuOiEjgZ0fkWWP1vDWT 8+DWBIKuPIi/7UENyYg/fbhaGTxujzWcObQjh5eL1bZ1R0IxFYZXbt61ejzZaQUBQb7h /eV9VpCaCPIZ3taFRXQkH47MrnQUAFq1z9GYbWxQXqpJchiS1YOClL9F9qenbl9tJlOs cRyKCgwExzfyAO2LibzGohY1ZzgzsXGNJXiKfkQHGNyKN/SC3jjM6Nx05eLDYnvlCVle 5s5XrqUOCIglnDPEKUCFL3N+wtMIYANBKeYHvh1vztlhxt1r+jnCyVkIqHWqu6lBV9m5 Tgrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=2IG3UESdPNi5LQbBIhjibhi1+I8A1Vgi7pomefTl3X8=; fh=hQUEiiksHvYN/EFmEKRXMJqwCC0zT2cV3viCNHAv7Ok=; b=UW7kYQKBln6sUhQ1MgbmC1S5dFSII1P6tuXpoFROcobfexr1WKW6uQw0lJiT6BkzqN H4gVppPAl+cNm8AF9mYDF+0vJwDnk2r1QB1G8aOXEcq16G4HDHidyFZodiwNcg8Q/hJS wG29VNiJxrKnp0bGwqhsxqUo2R98f/TOOhDk37mKI8P1wFvTyRFWMppAjMD53wtnhaDS Alsr16lyuUJ7I241oBwg6Bkub+/fyu663i0R9yOeNxBc2v3pCBPiLCSpFKJ3a4/CFRhX HonV7N7nTcZK6oXZWNNwqqpoC57hMVfPnuZmzhUQSqns7JcWLZBL2P3pR7adgnMujUFo qpTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ERvDa4x+; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id v63-20020a638942000000b005644829012fsi3379205pgd.701.2023.09.22.03.10.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 03:10:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ERvDa4x+; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5FCD88325E8E; Fri, 22 Sep 2023 02:49:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231976AbjIVJt2 (ORCPT + 56 others); Fri, 22 Sep 2023 05:49:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230064AbjIVJt2 (ORCPT ); Fri, 22 Sep 2023 05:49:28 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81D188F for ; Fri, 22 Sep 2023 02:49:22 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83D33C433CA; Fri, 22 Sep 2023 09:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695376162; bh=2PkDm1MBm9PwOayUT8B1AXo/8GTs8ZUrZ1gkVupKLIA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=ERvDa4x+FiQk+KW9/bcKyjBekstgDIhGC9arW4HDX2iFt41YsW420PUWBTtuz1zV0 gP6yBt615lK7gBy//cYNsdDRPMEZa5SDuJzWeh2m6T3XNaboGKNYZxI4Sd45LUKvms B0W9UkbKMPwB/5XNJ2BybnNUbAtTbt1K61STrDovmnBMJPsn1tiHPBNGeGlM80lmNS wkrJAT0o6dEoRnUdhbBHsrTORUnbDoeN40SK2FnpCQKBya4zPrCFTExKfFy/ulHHxW vzYrScQ+uRsBN4YNSnAuljw/Sw/q+MDH4Ux9Y2AbDBEaxobr1XqDpkn7KMn2zv/xH/ dVAKf7LVG6G9A== From: Kalle Valo To: ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org Subject: Re: [PATCH] wifi: ath11k: mac: fix struct ieee80211_sband_iftype_data handling References: <20230921075440.1539515-1-kvalo@kernel.org> Date: Fri, 22 Sep 2023 12:49:19 +0300 In-Reply-To: <20230921075440.1539515-1-kvalo@kernel.org> (Kalle Valo's message of "Thu, 21 Sep 2023 10:54:40 +0300") Message-ID: <87ediqa674.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 22 Sep 2023 02:49:30 -0700 (PDT) Kalle Valo writes: > From: Kalle Valo > > Commit e8c1841278a7 ("wifi: cfg80211: annotate iftype_data pointer with > sparse") added sparse checks for struct ieee80211_sband_iftype_data handling > which immediately found an issue in ath11k: > > drivers/net/wireless/ath/ath11k/mac.c:7952:22: warning: incorrect type > in argument 1 (different address spaces) > drivers/net/wireless/ath/ath11k/mac.c:7952:22: expected struct > ieee80211_sta_he_cap const *he_cap > drivers/net/wireless/ath/ath11k/mac.c:7952:22: got struct > ieee80211_sta_he_cap const [noderef] __iftype_data * > > The problem here is that we are accessing sband->iftype_data directly even > though we should use for_each_sband_iftype_data(). Now we iterate over each > item in the array and use the correct vif type which this vif is using. > > Tested-on: WCN6855 hw2.0 PCI > WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 > > Reported-by: Johannes Berg > Signed-off-by: Kalle Valo [...] > @@ -7949,7 +7951,17 @@ ath11k_mac_bitrate_mask_get_single_nss(struct ath11k *ar, > return false; > } > > - he_mcs_map = le16_to_cpu(ath11k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap)); > + for_each_sband_iftype_data(sband, i, iftd) { > + if (iftd->types_mask & BIT(arvif->vif->type)) { > + iftype_data = iftd; > + break; > + } > + } > + > + if (iftype_data == NULL) > + return false; > + > + he_mcs_map = le16_to_cpu(ath11k_mac_get_tx_mcs_map(&iftype_data->he_cap)); Johannes pointed out that I should use ieee80211_get_he_iftype_cap_vif() instead. I'll submit v2. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches