vc/amd/sb800: Cast to UINT32 for shift out of bounds fix

It’s defined as `unsigned char`.

    SB800: sb_Before_Pci_Init
    shift out of bounds src/vendorcode/amd/cimx/sb800/SBCMN.c:643:53
    ubsan: unrecoverable error.

Found-by: UBSAN
Change-Id: I0c5fa16bce5b68ed3b48bb17eae6d81af894b688
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51284
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
This commit is contained in:
Paul Menzel 2021-03-05 01:16:14 +01:00 committed by Patrick Georgi
parent 4715c6219c
commit f16a5ec871
1 changed files with 3 additions and 3 deletions

View File

@ -640,12 +640,12 @@ abcfgTbl (
while ( (pABTbl->regType) != 0xFF ) {
if ( pABTbl->regType > AXINDC ) {
ddValue = pABTbl->regIndex | (pABTbl->regType << 29);
ddValue = pABTbl->regIndex | ((UINT32) pABTbl->regType << 29);
writeAlink (ddValue, ((readAlink (ddValue)) & (0xFFFFFFFF^ (pABTbl->regMask))) | pABTbl->regData);
} else {
ddValue = 0x30 | (pABTbl->regType << 29);
ddValue = 0x30 | ((UINT32) pABTbl->regType << 29);
writeAlink (ddValue, pABTbl->regIndex);
ddValue = 0x34 | (pABTbl->regType << 29);
ddValue = 0x34 | ((UINT32) pABTbl->regType << 29);
writeAlink (ddValue, ((readAlink (ddValue)) & (0xFFFFFFFF^ (pABTbl->regMask))) | pABTbl->regData);
}
++pABTbl;