diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2017-03-02 13:52:54 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2017-03-09 12:45:49 +0100 |
commit | bfa72ce23b4c3b2a5515a820c1fe1b747e4c0449 (patch) | |
tree | 31c884501174a0ffeeb5c1aa5f590ab0a677f86c /src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c | |
parent | 49b4a8932349e01ed65e2528e82ea0dfa25410e1 (diff) | |
download | coreboot-bfa72ce23b4c3b2a5515a820c1fe1b747e4c0449.tar.gz coreboot-bfa72ce23b4c3b2a5515a820c1fe1b747e4c0449.tar.bz2 coreboot-bfa72ce23b4c3b2a5515a820c1fe1b747e4c0449.zip |
AGESA: Make eventlog more tolerant to failures
We have been forced to build AGESA with ASSERT() as non-fatal
for some board, as hitting those errors is not uncommon.
For the cases touched here, abort eventlog operations early
to avoid further errors and dereference of null pointers.
Change-Id: I1a09ad55d998502ad19273cfcd8d6588d85d5e0c
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/18543
Tested-by: build bot (Jenkins)
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Diffstat (limited to 'src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c')
-rw-r--r-- | src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c b/src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c index 74a72a914e8e..841c39f815b7 100644 --- a/src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c +++ b/src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c @@ -124,6 +124,8 @@ AmdReadEventLog ( ASSERT (Event != NULL); Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader); Status = GetEventLog (&LogEvent, &Event->StdHeader); + if (Status != AGESA_SUCCESS) + return Status; Event->EventClass = LogEvent.EventClass; Event->EventInfo = LogEvent.EventInfo; @@ -222,6 +224,9 @@ PutEventLog ( AgesaEventAlloc = NULL; GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader); ASSERT (AgesaEventAlloc != NULL); + if (AgesaEventAlloc == NULL) + return; + Index = AgesaEventAlloc->WriteRecordPtr; // Add the new event log data into a circular buffer @@ -284,6 +289,8 @@ GetEventLog ( GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader); ASSERT (AgesaEventAlloc != NULL); + if (AgesaEventAlloc == NULL) + return AGESA_BOUNDS_CHK; if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) && (AgesaEventAlloc->ReadWriteFlag == 1)) { @@ -341,6 +348,8 @@ PeekEventLog ( GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader); ASSERT (AgesaEventAlloc != NULL); + if (AgesaEventAlloc == NULL) + return FALSE; if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) && (AgesaEventAlloc->ReadWriteFlag == 1)) { |