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 2128118DF68; Mon, 28 Oct 2024 06:39:33 +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=1730097573; cv=none; b=PxHW0oXY4s6dCK+Ur/a7d7oqKVK224PtzWTA1WA6ojqn6O+nk2mI2rCcNAlBTarTLP1o4ruWBT/j6Z8GZOstGBUrWmZG9JgIhU9f+XsSG+IYlhrV9RfE9obPNxVjd29Tgn2MoGYMPQaKuqCxGqyIQ4rZuJvc61Q/plQCvbEbqss= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730097573; c=relaxed/simple; bh=/l4O6y7PYW5y8fPhK9kzBQCT0l2K8bwx+nVw37iK5/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UFK0YPQoleqEOyl0J/6mgrdBotpYC3IGxmLtYPg031lKPuRYyXfnm8lIYA4WBrUSAEaNpV3IqfmWRea1hkicDVE91/wxpc0LqvhDD4EBdsXF1MjRlDO0RwiE2tHf+iKgC+RjiPl9x7nWfxBu5rZ1+4Nsuxo1hqJtNWCmvb47B90= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xi39OjVF; 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="xi39OjVF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6110C4CEC3; Mon, 28 Oct 2024 06:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730097573; bh=/l4O6y7PYW5y8fPhK9kzBQCT0l2K8bwx+nVw37iK5/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xi39OjVFOi1W07B9pmg3rb2XjJSUskYnbryhSDxvEEbhiodcMZcbNPLFPLYGAi4JL hmS4RWKtrVfUoUIG2An2mRsh/r4YwbEhuCq6lU3PqeW39rq/E2Hqmzarf2D/3rBnRt xrY6HGj+NZ2glxfwF5/2aPUYd48ER/1RcuxAiTiY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Colin Ian King , Dan Carpenter , Paolo Abeni , Sasha Levin Subject: [PATCH 6.6 051/208] octeontx2-af: Fix potential integer overflows on integer shifts Date: Mon, 28 Oct 2024 07:23:51 +0100 Message-ID: <20241028062307.913551079@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241028062306.649733554@linuxfoundation.org> References: <20241028062306.649733554@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Colin Ian King [ Upstream commit 637c4f6fe40befa04f19c38b5d15429cbb9191d9 ] The left shift int 32 bit integer constants 1 is evaluated using 32 bit arithmetic and then assigned to a 64 bit unsigned integer. In the case where the shift is 32 or more this can lead to an overflow. Avoid this by shifting using the BIT_ULL macro instead. Fixes: 019aba04f08c ("octeontx2-af: Modify SMQ flush sequence to drop packets") Signed-off-by: Colin Ian King Reviewed-by: Dan Carpenter Link: https://patch.msgid.link/20241010154519.768785-1-colin.i.king@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c index 224a025283ca7..29487518ca672 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c @@ -2298,7 +2298,7 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr, NIX_AF_TL3_TL2X_LINKX_CFG(tl2_tl3_link_schq, link)); if (!(cfg & BIT_ULL(12))) continue; - bmap |= (1 << i); + bmap |= BIT_ULL(i); cfg &= ~BIT_ULL(12); rvu_write64(rvu, blkaddr, NIX_AF_TL3_TL2X_LINKX_CFG(tl2_tl3_link_schq, link), cfg); @@ -2319,7 +2319,7 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr, /* Set NIX_AF_TL3_TL2_LINKX_CFG[ENA] for the TL3/TL2 queue */ for (i = 0; i < (rvu->hw->cgx_links + rvu->hw->lbk_links); i++) { - if (!(bmap & (1 << i))) + if (!(bmap & BIT_ULL(i))) continue; cfg = rvu_read64(rvu, blkaddr, NIX_AF_TL3_TL2X_LINKX_CFG(tl2_tl3_link_schq, link)); -- 2.43.0