From f2a7ba3b8def06e2492dc68cee9abe4301068b6d Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 11 Jun 2018 13:21:53 -0700 Subject: [PATCH] kernel - Improve ACPI compatibility with older BIOSes * ACPI alignment field in ACPI resources can sometimes be 0, leading to passing 0 for 'align' to acpi_res_set_iorange() which panics the box with a division-by-zero fault. * Relax handling of this argument by setting it to 1 if it is found to be 0. * Fixes DFly panics with certain older BIOSes. Reported-by: myu --- sys/dev/acpica/acpi_resource.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c index e689932448..6730524f7c 100644 --- a/sys/dev/acpica/acpi_resource.c +++ b/sys/dev/acpica/acpi_resource.c @@ -527,6 +527,8 @@ acpi_res_set_iorange(device_t dev, void *context, uint64_t low, if (cp == NULL) return; + if (align == 0) /* broken acpi resources might pass align == 0 */ + align = 1; base = roundup(low, align); if (base + length - 1 <= high) { -- 2.41.0