From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF12F1E485; Tue, 8 Oct 2024 12:17:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728389826; cv=none; b=TARpGm17SolaAsm0gioXMbULTZKWXyLQzl75moQfeabuOyVEoWehc15lFB9W7v8uF3pLY+boIZ0VcaAUGZPn5SGcW2tzreGhw7tMMCyPoXRjw16UmRZ6aXU6LrmQCqWIJmuZmqsAcx4VJd25cI/36I2io4HWGTpsR6V3y+a2eUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728389826; c=relaxed/simple; bh=QJuTb1Efk5qv2OxVLQEvNtqNnwlq/eGWgj2MesnXzwk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HpwYcBiwkHM/xyzbVPVOAJM2J/f03/ZyF4ImOXKzpikdK+kXixXIaP7GFVP40dNDN6PA/EKlCtEBzXZcx0oZpwbT5+IfYxRtwimrJcSIrvnVCkeaNkwhmMRYBkqFVCRTMgpnB/gAaw90X6vYSMn0gbzx7MGVt9Oq8J1V7peFdog= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KPMaK+Gp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KPMaK+Gp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF8C3C4CEC7; Tue, 8 Oct 2024 12:17:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728389826; bh=QJuTb1Efk5qv2OxVLQEvNtqNnwlq/eGWgj2MesnXzwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KPMaK+Gp0Fi5tP9v4EDnDCxInyEFV3IrqhNambF2T+DKS1xw/JOxvc/97bMmmJD50 gIrdfmiBOls4oalpmrwZ3T/r36OWO0vtMi5bPA9zG38xaVPNnHGsF5myvBB7mJtOm6 RSsiCFaqDHh2N3bLvm0fu8PUK/RNGa7Pt0XgmXv4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ping-Ke Shih , Sasha Levin Subject: [PATCH 6.10 107/482] wifi: rtw89: correct base HT rate mask for firmware Date: Tue, 8 Oct 2024 14:02:50 +0200 Message-ID: <20241008115652.519524768@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115648.280954295@linuxfoundation.org> References: <20241008115648.280954295@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ping-Ke Shih [ Upstream commit 45742881f9eee2a4daeb6008e648a460dd3742cd ] Coverity reported that u8 rx_mask << 24 will become signed 32 bits, which casting to unsigned 64 bits will do sign extension. For example, putting 0x80000000 (signed 32 bits) to a u64 variable will become 0xFFFFFFFF_80000000. The real case we meet is: rx_mask[0...3] = ff ff 00 00 ra_mask = 0xffffffff_ff0ff000 After this fix: rx_mask[0...3] = ff ff 00 00 ra_mask = 0x00000000_ff0ff000 Fortunately driver does bitwise-AND with incorrect ra_mask and supported rates (1ss and 2ss rate only) afterward, so the final rate mask of original code is still correct. Addresses-Coverity-ID: 1504762 ("Unintended sign extension") Signed-off-by: Ping-Ke Shih Link: https://patch.msgid.link/20240809072012.84152-5-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/phy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c index a82b4c56a6f45..f7c6b019b5be4 100644 --- a/drivers/net/wireless/realtek/rtw89/phy.c +++ b/drivers/net/wireless/realtek/rtw89/phy.c @@ -352,8 +352,8 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev, csi_mode = RTW89_RA_RPT_MODE_HT; ra_mask |= ((u64)sta->deflink.ht_cap.mcs.rx_mask[3] << 48) | ((u64)sta->deflink.ht_cap.mcs.rx_mask[2] << 36) | - (sta->deflink.ht_cap.mcs.rx_mask[1] << 24) | - (sta->deflink.ht_cap.mcs.rx_mask[0] << 12); + ((u64)sta->deflink.ht_cap.mcs.rx_mask[1] << 24) | + ((u64)sta->deflink.ht_cap.mcs.rx_mask[0] << 12); high_rate_masks = rtw89_ra_mask_ht_rates; if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC) stbc_en = 1; -- 2.43.0