From: Jiang Liu Date: Mon, 2 Feb 2015 02:42:57 +0000 (+0800) Subject: ACPI: Enforce stricter checks for address space descriptors X-Git-Tag: v5.15~16251^2~1^5~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a274019fc332d7b4dcb85735978c2018522be312;p=platform%2Fkernel%2Flinux-starfive.git ACPI: Enforce stricter checks for address space descriptors Enforce stricter checks for address space descriptors according to ACPI spec. Signed-off-by: Jiang Liu Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 5bf73a9..57891a6 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -192,6 +192,15 @@ static bool acpi_decode_space(struct resource *res, bool wp = addr->info.mem.write_protect; u64 len = attr->address_length; + /* + * Filter out invalid descriptor according to ACPI Spec 5.0, section + * 6.4.3.5 Address Space Resource Descriptors. + */ + if ((addr->min_address_fixed != addr->max_address_fixed && len) || + (addr->min_address_fixed && addr->max_address_fixed && !len)) + pr_debug("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n", + addr->min_address_fixed, addr->max_address_fixed, len); + res->start = attr->minimum; res->end = attr->maximum;