diff options
author | Saket Dumbre <97769119+sacdintel@users.noreply.github.com> | 2023-03-22 15:32:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 15:32:26 -0700 |
commit | 14213b11435bb1bd8490cf73f5d731b7f3578d8b (patch) | |
tree | 6916459d601868bb0f1fab95596f08f6b261c348 | |
parent | 01f11f2671451825e9c0db92ab1db69e1c4e941c (diff) | |
parent | b3317239749d1907ec95e7aa2057d7ea29d3c638 (diff) | |
download | acpica-14213b11435bb1bd8490cf73f5d731b7f3578d8b.tar.gz |
Merge pull request #854 from tamird/ub-load-of-misaligned-address-two
Avoid undefined behavior: load of misaligned address
-rw-r--r-- | source/components/resources/rsmisc.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 52358421c..6d11442d9 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -349,7 +349,8 @@ AcpiRsConvertAmlToResource ( case ACPI_RSC_COUNT_SERIAL_VEN: - ItemCount = ACPI_GET16 (Source) - Info->Value; + ACPI_MOVE_16_TO_16(&Temp16, Source); + ItemCount = Temp16 - Info->Value; Resource->Length = Resource->Length + ItemCount; ACPI_SET16 (Destination, ItemCount); @@ -357,9 +358,10 @@ AcpiRsConvertAmlToResource ( case ACPI_RSC_COUNT_SERIAL_RES: + ACPI_MOVE_16_TO_16(&Temp16, Source); ItemCount = (AmlResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER)) - - ACPI_GET16 (Source) - Info->Value; + Temp16 - Info->Value; Resource->Length = Resource->Length + ItemCount; ACPI_SET16 (Destination, ItemCount); @@ -437,8 +439,9 @@ AcpiRsConvertAmlToResource ( /* Copy the ResourceSource string */ + ACPI_MOVE_16_TO_16 (&Temp16, Source); Source = ACPI_ADD_PTR ( - void, Aml, (ACPI_GET16 (Source) + Info->Value)); + void, Aml, (Temp16 + Info->Value)); AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); break; |