summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2014-12-29 19:34:56 +0100
committerPatrick Georgi <pgeorgi@google.com>2014-12-30 20:54:17 +0100
commitbcf07c3f24e949b6a16f69ca5d21c5ecb1c9056e (patch)
tree5f3cc155c3d85f04f4d1dcb4461771b8775e21c1
parent82292441c7ffe941b4722bbcbac958face576ad4 (diff)
libpayload: don't dereference null pointer in exception handler
Change-Id: I93e5e2488ddd616c91769beb1acd96f8ebd7d505 Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Found-by: Coverity Scan Reviewed-on: http://review.coreboot.org/7971 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <gaumless@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r--payloads/libpayload/arch/x86/exception.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/payloads/libpayload/arch/x86/exception.c b/payloads/libpayload/arch/x86/exception.c
index 33bef71e66..e1ff3a54c6 100644
--- a/payloads/libpayload/arch/x86/exception.c
+++ b/payloads/libpayload/arch/x86/exception.c
@@ -141,14 +141,16 @@ static void dump_stack(uintptr_t addr, size_t bytes)
static void dump_exception_state(struct exception_handler_state *state,
struct exception_handler_info *info)
{
- if (info)
+ if (info) {
printf("Exception %d (%s)\n", state->vector, info->name);
- else
+
+ if (info->error_code_printer) {
+ printf("Error code: ");
+ info->error_code_printer(state->error_code);
+ printf("\n");
+ }
+ } else {
printf("Unrecognized exception %d\n", state->vector);
- if (info->error_code_printer) {
- printf("Error code: ");
- info->error_code_printer(state->error_code);
- printf("\n");
}
printf("EIP: 0x%08x\n", state->regs.eip);
printf("CS: 0x%04x\n", state->regs.cs);