vc/amd/sb800: Fix out of bounds shift

Fix the two issues below.

    SB800: sb_Before_Pci_Init
    shift out of bounds src/vendorcode/amd/cimx/sb800/PCILIB.c:49:18
    ubsan: unrecoverable error.

    SB800: sb_Before_Pci_Init
    shift out of bounds src/vendorcode/amd/cimx/sb800/PCILIB.c:66:18
    ubsan: unrecoverable error.

Found by: UBSAN
Change-Id: Id42e62d35f59793bad10998f14422ab7fb4fc029
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51283
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:09:07 +01:00 committed by Paul Fagerburg
parent f9080ce6d9
commit 1a7640dc62
1 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ ReadPCI (
if ( (UINT16)Address < 0xff ) {
//Normal Config Access
UINT32 AddrCf8;
AddrCf8 = (1 << 31) + ((Address >> 8) & 0x0FFFF00) + (Address & 0xFC);
AddrCf8 = (1U << 31) + ((Address >> 8) & 0x0FFFF00) + (Address & 0xFC);
WriteIO (0xCf8, AccWidthUint32, &AddrCf8);
ReadIO ((UINT16) (0xCfC + (Address & 0x3)), OpFlag, Value);
}
@ -63,7 +63,7 @@ WritePCI (
if ( (UINT16)Address < 0xff ) {
//Normal Config Access
UINT32 AddrCf8;
AddrCf8 = (1 << 31) + ((Address >> 8)&0x0FFFF00) + (Address & 0xFC);
AddrCf8 = (1U << 31) + ((Address >> 8)&0x0FFFF00) + (Address & 0xFC);
WriteIO (0xCf8, AccWidthUint32, &AddrCf8);
WriteIO ((UINT16) (0xCfC + (Address & 0x3)), OpFlag, Value);
}