From 69569e530645e0a984d5134059a6065d9252e8eb Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Fri, 5 Mar 2021 01:24:41 +0100 Subject: vc/amd/sb800: SBCMN: Cast to 32-bit before shift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SB800: sb_Before_Pci_Init shift out of bounds src/vendorcode/amd/cimx/sb800/SBCMN.c:486:57 ubsan: unrecoverable error. Found-by: UBSAN Change-Id: Id05b96f1f4cf4a1cf8283db22e10ab8df833406d Signed-off-by: Paul Menzel Reviewed-on: https://review.coreboot.org/c/coreboot/+/51286 Reviewed-by: Michał Żygowski Tested-by: build bot (Jenkins) --- src/vendorcode/amd/cimx/sb800/SBCMN.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vendorcode/amd/cimx/sb800/SBCMN.c b/src/vendorcode/amd/cimx/sb800/SBCMN.c index ab203a111d..8f1bbf9190 100644 --- a/src/vendorcode/amd/cimx/sb800/SBCMN.c +++ b/src/vendorcode/amd/cimx/sb800/SBCMN.c @@ -417,9 +417,9 @@ commonInitEarlyBoot ( abLinkInitBeforePciEnum (pConfig); // Set ABCFG registers // AB MSI if ( pConfig->BuildParameters.AbMsi) { - abValue = readAlink (SB_ABCFG_REG94 | (UINT32) (ABCFG << 29)); + abValue = readAlink (SB_ABCFG_REG94 | ((UINT32) ABCFG << 29)); abValue = abValue | BIT20; - writeAlink (SB_ABCFG_REG94 | (UINT32) (ABCFG << 29), abValue); + writeAlink (SB_ABCFG_REG94 | ((UINT32) ABCFG << 29), abValue); } @@ -483,12 +483,12 @@ abSpecialSetBeforePciEnum ( ) { UINT32 abValue; - abValue = readAlink (SB_ABCFG_REGC0 | (UINT32) (ABCFG << 29)); + abValue = readAlink (SB_ABCFG_REGC0 | ((UINT32) ABCFG << 29)); abValue &= 0xf0; if ( pConfig->SbPcieOrderRule && abValue ) { - abValue = readAlink (SB_RCINDXC_REG02 | (UINT32) (RCINDXC << 29)); + abValue = readAlink (SB_RCINDXC_REG02 | ((UINT32) RCINDXC << 29)); abValue = abValue | BIT9; - writeAlink (SB_RCINDXC_REG02 | (UINT32) (RCINDXC << 29), abValue); + writeAlink (SB_RCINDXC_REG02 | ((UINT32) RCINDXC << 29), abValue); } } @@ -620,7 +620,7 @@ abLinkInitBeforePciEnum ( pAbTblPtr = (ABTBLENTRY *) FIXUP_PTR (&abTblEntry800[0]); abcfgTbl (pAbTblPtr); if ( cimResetCpuOnSyncFlood ) { - rwAlink (SB_ABCFG_REG10050 | (UINT32) (ABCFG << 29), ~BIT2, BIT2); + rwAlink (SB_ABCFG_REG10050 | ((UINT32) ABCFG << 29), ~BIT2, BIT2); } } -- cgit v1.2.3