diff options
-rw-r--r-- | source/components/resources/rslist.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/components/resources/rslist.c b/source/components/resources/rslist.c index bce499170..cb408197e 100644 --- a/source/components/resources/rslist.c +++ b/source/components/resources/rslist.c @@ -209,7 +209,12 @@ AcpiRsConvertAmlToResources ( if (AcpiUtGetResourceType (Aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) { - if (AmlResource->CommonSerialBus.Type > + /* Avoid undefined behavior: member access within misaligned address */ + + AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus; + memcpy(&CommonSerialBus, AmlResource, sizeof(CommonSerialBus)); + + if (CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE) { ConversionTable = NULL; @@ -219,7 +224,7 @@ AcpiRsConvertAmlToResources ( /* This is an I2C, SPI, UART, or CSI2 SerialBus descriptor */ ConversionTable = AcpiGbl_ConvertResourceSerialBusDispatch [ - AmlResource->CommonSerialBus.Type]; + CommonSerialBus.Type]; } } else |