amd/cimx/sb?00/SATA.c: Integer overflow in loop condition

The conditional comparison in the for-loop construct with the constant
300000 has an index incrementor of type 'UINT16' (aka 'unsigned short')
which is always true.

Change-Id: I932c168742163be4038728fb40833231a447fa78
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-on: http://review.coreboot.org/5799
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
This commit is contained in:
Edward O'Callaghan 2014-05-21 09:42:56 +10:00 committed by Marc Jones
parent 03b00e9675
commit 8a661ed788
2 changed files with 2 additions and 2 deletions

View File

@ -238,7 +238,7 @@ void sataInitAfterPciEnum(AMDSBCFG* pConfig){
void sataDriveDetection(AMDSBCFG* pConfig, UINT32 ddBar5){ void sataDriveDetection(AMDSBCFG* pConfig, UINT32 ddBar5){
UINT32 ddVar0; UINT32 ddVar0;
UINT8 dbPortNum, dbVar0; UINT8 dbPortNum, dbVar0;
UINT16 dwIoBase, dwVar0; UINT32 dwIoBase, dwVar0;
TRACE((DMSG_SB_TRACE, "CIMx - Entering sata drive detection procedure\n\n")); TRACE((DMSG_SB_TRACE, "CIMx - Entering sata drive detection procedure\n\n"));
TRACE((DMSG_SB_TRACE, "SATA BAR5 is %X \n", ddBar5)); TRACE((DMSG_SB_TRACE, "SATA BAR5 is %X \n", ddBar5));

View File

@ -568,7 +568,7 @@ sataDriveDetection (
UINT8 dbPortNum; UINT8 dbPortNum;
UINT8 dbVar0; UINT8 dbVar0;
UINT16 dwIoBase; UINT16 dwIoBase;
UINT16 dwVar0; UINT32 dwVar0;
if ( (pConfig->SataClass == NATIVE_IDE_MODE) || (pConfig->SataClass == LEGACY_IDE_MODE) || (pConfig->SataClass == IDE_TO_AHCI_MODE) ) { if ( (pConfig->SataClass == NATIVE_IDE_MODE) || (pConfig->SataClass == LEGACY_IDE_MODE) || (pConfig->SataClass == IDE_TO_AHCI_MODE) ) {
for ( dbPortNum = 0; dbPortNum < 4; dbPortNum++ ) { for ( dbPortNum = 0; dbPortNum < 4; dbPortNum++ ) {
ReadMEM (*pBar5 + SB_SATA_BAR5_REG128 + dbPortNum * 0x80, AccWidthUint32, &ddVar0); ReadMEM (*pBar5 + SB_SATA_BAR5_REG128 + dbPortNum * 0x80, AccWidthUint32, &ddVar0);