Edward O'Callaghan (eocallaghan@alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7676
-gerrit
commit 4618ad3de79e33c34c7c625a1d941c1f6f9caea9 Author: Edward O'Callaghan eocallaghan@alterapraxis.com Date: Sun Dec 7 05:20:14 2014 +1100
amd/agesa/f16kb/Lib/amdlib.c: Integer overflow in loop construct
As is the case in commit:
3312ed7 amd/agesa/f1?/Lib/amdlib.c: Integer overflow in loop construct
The semantics of this loop relies on an integer overflow in Index >=0 that implies a return value of (UINT8)-1 which around wraps to 0xFF, or VOLT_UNSUPPORTED.
Change-Id: Iced3eff3ae7b8935db3bdd6147372cf3b540883c Signed-off-by: Edward O'Callaghan eocallaghan@alterapraxis.com --- src/vendorcode/amd/agesa/f16kb/Lib/amdlib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/vendorcode/amd/agesa/f16kb/Lib/amdlib.c b/src/vendorcode/amd/agesa/f16kb/Lib/amdlib.c index d0e66b9..3a7ada8 100644 --- a/src/vendorcode/amd/agesa/f16kb/Lib/amdlib.c +++ b/src/vendorcode/amd/agesa/f16kb/Lib/amdlib.c @@ -360,11 +360,11 @@ LibAmdBitScanReverse ( IN UINT32 value ) { - UINTN Index; + UINT8 Index; for (Index = 31; Index >= 0; Index--){ - if (value & (1 << Index)) break; + if (value & (1 << Index)) return Index; } - return (UINT8) Index; + return 0xFF; } VOID LibAmdMsrRead (