acpi/acpi: make sure that table_ptr is non-NULL in acpidump_print

While acpidump_print shouldn't be called with a NULL pointer as
table_ptr argument, better add a check to not end up dereferencing the
NULL pointer.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: Ic3cc103c8a47fb8c2fe4262236ea47013af27c4f
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79393
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com>
This commit is contained in:
Felix Held 2023-08-03 01:08:14 +02:00 committed by Martin L Roth
parent 372dfe0e20
commit 67b3c8f278
1 changed files with 2 additions and 0 deletions

View File

@ -1367,6 +1367,8 @@ static void acpixtract_compatible_hexdump(const void *memory, size_t length)
static void acpidump_print(void *table_ptr)
{
if (table_ptr == NULL)
return;
const acpi_header_t *header = (acpi_header_t *)table_ptr;
const size_t table_size = header->length;
printk(BIOS_SPEW, "%.4s @ 0x0000000000000000\n", header->signature);