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 5530E1494BB; Tue, 11 Mar 2025 15:24:55 +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=1741706696; cv=none; b=XYFUZTXpvvTj9NpQIJ+MDEoZ6gVXuUuR/RuOQWQF9PWakT4+mq89Tv4tr1GQQCq4BZroumunt3+uukL+T/meugvwFn0Z2hoXFASJa1Aa6EBZXxPmkI1KJIKiwjiPBunoeiud02Cs7FNFequHSd2j7mXF1xlLkl6kdSGMJcUCBbY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741706696; c=relaxed/simple; bh=3DpbZc2duZ7oawCOkl1T8pxbCBozvvOxNI3RsnuY0XA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GadISUr3JCYa2NmTtVRfx/2kelIyiERkQasL1RVdt7ALGm3hxFPnKXaDOSTDXwlbz37ZhtK37rlp6dGwIOWUiyvTk/sc39BJF36TL349WOIXBPMXWYsCmNpLCgKaSIwL7bJ3Sze4ff+47XfZA/RcWedZWMNIrBgG45qy9q3cyHU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uZnI3zbI; 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="uZnI3zbI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78389C4CEE9; Tue, 11 Mar 2025 15:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741706695; bh=3DpbZc2duZ7oawCOkl1T8pxbCBozvvOxNI3RsnuY0XA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uZnI3zbIkJWv0F3LltSAFXQoQHKx95Fm4YKVW+w31c5tI+ptUcb5ONpn/YgjL6Uz1 63MficYuuMtKZeHOmSkBYq+H3iXNJ+qLzl24fqwiSU7tSLrofCrc2wqgQRNyXaLFrR 74fXui4iNOWCDfbG/jKTsyX4T+TB8toSdKUPYaH8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dmitry Antipov , Arend van Spriel , Kalle Valo , Sasha Levin Subject: [PATCH 5.10 135/462] wifi: brcmsmac: add gain range check to wlc_phy_iqcal_gainparams_nphy() Date: Tue, 11 Mar 2025 15:56:41 +0100 Message-ID: <20250311145803.692666264@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250311145758.343076290@linuxfoundation.org> References: <20250311145758.343076290@linuxfoundation.org> User-Agent: quilt/0.68 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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Antipov [ Upstream commit 3f4a0948c3524ae50f166dbc6572a3296b014e62 ] In 'wlc_phy_iqcal_gainparams_nphy()', add gain range check to WARN() instead of possible out-of-bounds 'tbl_iqcal_gainparams_nphy' access. Compile tested only. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Antipov Acked-by: Arend van Spriel Signed-off-by: Kalle Valo Link: https://patch.msgid.link/20241210070441.836362-1-dmantipov@yandex.ru Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c index 8580a27547891..42e7bc67e9143 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c @@ -23427,6 +23427,9 @@ wlc_phy_iqcal_gainparams_nphy(struct brcms_phy *pi, u16 core_no, break; } + if (WARN_ON(k == NPHY_IQCAL_NUMGAINS)) + return; + params->txgm = tbl_iqcal_gainparams_nphy[band_idx][k][1]; params->pga = tbl_iqcal_gainparams_nphy[band_idx][k][2]; params->pad = tbl_iqcal_gainparams_nphy[band_idx][k][3]; -- 2.39.5