lib: acpi: Add asserts catching overflow

Add asserts catching sub-sctructure overflow.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2023-12-20 11:20:04 +02:00 committed by Maureen Helm
parent d90060aad7
commit 80c8e9736b

View file

@ -753,6 +753,7 @@ void acpi_dmar_foreach_subtable(ACPI_TABLE_DMAR *dmar,
ACPI_DMAR_HEADER *subtable = ACPI_ADD_PTR(ACPI_DMAR_HEADER, dmar, offset);
__ASSERT_NO_MSG(subtable->Length >= sizeof(*subtable));
__ASSERT_NO_MSG(subtable->Length <= length - offset);
func(subtable, arg);
@ -773,6 +774,7 @@ void acpi_dmar_foreach_devscope(ACPI_DMAR_HARDWARE_UNIT *hu,
hu, offset);
__ASSERT_NO_MSG(devscope->Length >= sizeof(*devscope));
__ASSERT_NO_MSG(devscope->Length <= length - offset);
func(devscope, arg);