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 92B2019048F; Mon, 28 Oct 2024 06:34:46 +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=1730097286; cv=none; b=jlJTsKqItUB8C7IM10RsXK0sb+tvOYTjSmvGtimnLGOTBY2v/Qt/zTDgyaN5VUNfhcpMAWmn12H6v201Syo69mo9nqlxPJV5bm+OCe2VDjgYz6NZGDwNHMFM1spOn9747Bqt9KhoTGilFnbY5REKMIwzZqcEfQnE0jfLogjNpVU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730097286; c=relaxed/simple; bh=hpxTOt3YQ3IxwawnAJ4KCYYJD7a/HzNy5lgESytHT8I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O2G7lX+8qlZyc5lIl8p7tNqGIOhseDxPxw5hlgai4yLNmz3vqEXEVIwCDbFFctYG/U9KZyYbjsmdRWRyxlCbv8KVT3qzUA+DNZj+I6P8g0bIWn988p/vKhk5m45uC//7HIumCj5VUD5Mi4glw3vMnVuO4tUSlgnJSjJiGRmtpHs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NDXxGf42; 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="NDXxGf42" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D28DC4CEC3; Mon, 28 Oct 2024 06:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730097286; bh=hpxTOt3YQ3IxwawnAJ4KCYYJD7a/HzNy5lgESytHT8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NDXxGf42x5CYVrLhxBohrW+NWvtGUimBg0smzYmWdtiVd3rW8FMRRuFU/xILeYb7r 3w1KLPhgtXG3iWK0iyh6+C//+mvgoLf0wk6FDQxz3Xmp7fCKIePB2NH3TpXySO4yly bkaVFdqAkH+xyhlXWxhaBnCFvZV0r3XGVZxsxjCs= 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.1 028/137] octeontx2-af: Fix potential integer overflows on integer shifts Date: Mon, 28 Oct 2024 07:24:25 +0100 Message-ID: <20241028062259.510080245@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241028062258.708872330@linuxfoundation.org> References: <20241028062258.708872330@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.1-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 7ed0eb9bd4ed2..95a8ccd18a4f7 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c @@ -2279,7 +2279,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); @@ -2300,7 +2300,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