mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
This commit is contained in:
parent
711c07db68
commit
8f118e25ec
1 changed files with 6 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue