summaryrefslogtreecommitdiff
path: root/source/components/resources/rscalc.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/components/resources/rscalc.c')
-rw-r--r--source/components/resources/rscalc.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c
index 623364b10..55694f1ec 100644
--- a/source/components/resources/rscalc.c
+++ b/source/components/resources/rscalc.c
@@ -740,14 +740,19 @@ AcpiRsGetListLength (
}
break;
- case ACPI_RESOURCE_NAME_SERIAL_BUS:
+ case ACPI_RESOURCE_NAME_SERIAL_BUS: {
+ /* Avoid undefined behavior: member access within misaligned address */
+
+ AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus;
+ memcpy(&CommonSerialBus, AmlResource, sizeof(CommonSerialBus));
MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[
- AmlResource->CommonSerialBus.Type];
+ CommonSerialBus.Type];
ExtraStructBytes +=
- AmlResource->CommonSerialBus.ResourceLength -
+ CommonSerialBus.ResourceLength -
MinimumAmlResourceLength;
break;
+ }
case ACPI_RESOURCE_NAME_PIN_CONFIG:
@@ -816,8 +821,13 @@ AcpiRsGetListLength (
if (AcpiUtGetResourceType (AmlBuffer) ==
ACPI_RESOURCE_NAME_SERIAL_BUS)
{
+ /* Avoid undefined behavior: member access within misaligned address */
+
+ AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus;
+ memcpy(&CommonSerialBus, AmlResource, sizeof(CommonSerialBus));
+
BufferSize = AcpiGbl_ResourceStructSerialBusSizes[
- AmlResource->CommonSerialBus.Type] + ExtraStructBytes;
+ CommonSerialBus.Type] + ExtraStructBytes;
}
else
{