summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-02-17 19:00:14 +0000
committernjl <njl@FreeBSD.org>2005-02-17 19:00:14 +0000
commit25e3641222f6bbae8f81ea39fe0e0ebd3e265300 (patch)
tree51fcc1fb5895369b607f5257f8917741a3bc6013 /sys/dev/acpica
parent1ea47563dc919ffe54029bc4a88a9936f559def3 (diff)
downloadFreeBSD-src-25e3641222f6bbae8f81ea39fe0e0ebd3e265300.zip
FreeBSD-src-25e3641222f6bbae8f81ea39fe0e0ebd3e265300.tar.gz
Check for the address space type first before validating it. In particular,
we want to return EOPNOTSUPP for FFixedHW no matter what the address. Submitted by: Bruno Ducrot
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/acpi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 48f3cef..57f663e 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1080,10 +1080,10 @@ acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas,
int error, res_type;
error = ENOMEM;
- if (type == NULL || rid == NULL || gas == NULL || res == NULL ||
- !ACPI_VALID_ADDRESS(gas->Address) || gas->RegisterBitWidth < 8)
+ if (type == NULL || rid == NULL || gas == NULL || res == NULL)
return (EINVAL);
+ /* We only support memory and IO spaces. */
switch (gas->AddressSpaceId) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
res_type = SYS_RES_MEMORY;
@@ -1095,6 +1095,10 @@ acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas,
return (EOPNOTSUPP);
}
+ /* Validate the address after we're sure we support the space. */
+ if (!ACPI_VALID_ADDRESS(gas->Address) || gas->RegisterBitWidth < 8)
+ return (EINVAL);
+
bus_set_resource(dev, res_type, *rid, gas->Address,
gas->RegisterBitWidth / 8);
*res = bus_alloc_resource_any(dev, res_type, rid, RF_ACTIVE);
OpenPOWER on IntegriCloud