File tree Expand file tree Collapse file tree 5 files changed +15
-41
lines changed Expand file tree Collapse file tree 5 files changed +15
-41
lines changed Original file line number Diff line number Diff line change @@ -431,18 +431,13 @@ AcpiRsGetAddressCommon (
431
431
ACPI_RESOURCE * Resource ,
432
432
AML_RESOURCE * Aml )
433
433
{
434
-
435
- /* Avoid undefined behavior: member access within misaligned address */
436
-
437
- AML_RESOURCE_ADDRESS Address ;
438
- memcpy (& Address , Aml , sizeof (Address ));
439
434
ACPI_FUNCTION_ENTRY ();
440
435
441
436
/* Validate the Resource Type */
442
437
443
- if ((Address .ResourceType > 2 ) &&
444
- (Address .ResourceType < 0xC0 ) &&
445
- (Address .ResourceType != 0x0A ))
438
+ if ((Aml -> Address .ResourceType > 2 ) &&
439
+ (Aml -> Address .ResourceType < 0xC0 ) &&
440
+ (Aml -> Address .ResourceType != 0x0A ))
446
441
{
447
442
return (FALSE);
448
443
}
@@ -469,7 +464,7 @@ AcpiRsGetAddressCommon (
469
464
/* Generic resource type, just grab the TypeSpecific byte */
470
465
471
466
Resource -> Data .Address .Info .TypeSpecific =
472
- Address .SpecificFlags ;
467
+ Aml -> Address .SpecificFlags ;
473
468
}
474
469
475
470
return (TRUE);
@@ -497,7 +492,6 @@ AcpiRsSetAddressCommon (
497
492
{
498
493
ACPI_FUNCTION_ENTRY ();
499
494
500
-
501
495
/* Set the Resource Type and General Flags */
502
496
503
497
(void ) AcpiRsConvertResourceToAml (
Original file line number Diff line number Diff line change @@ -741,15 +741,11 @@ AcpiRsGetListLength (
741
741
break ;
742
742
743
743
case ACPI_RESOURCE_NAME_SERIAL_BUS : {
744
- /* Avoid undefined behavior: member access within misaligned address */
745
-
746
- AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus ;
747
- memcpy (& CommonSerialBus , AmlResource , sizeof (CommonSerialBus ));
748
744
749
745
MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes [
750
- CommonSerialBus .Type ];
746
+ AmlResource -> CommonSerialBus .Type ];
751
747
ExtraStructBytes +=
752
- CommonSerialBus .ResourceLength -
748
+ AmlResource -> CommonSerialBus .ResourceLength -
753
749
MinimumAmlResourceLength ;
754
750
break ;
755
751
}
@@ -821,13 +817,8 @@ AcpiRsGetListLength (
821
817
if (AcpiUtGetResourceType (AmlBuffer ) ==
822
818
ACPI_RESOURCE_NAME_SERIAL_BUS )
823
819
{
824
- /* Avoid undefined behavior: member access within misaligned address */
825
-
826
- AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus ;
827
- memcpy (& CommonSerialBus , AmlResource , sizeof (CommonSerialBus ));
828
-
829
820
BufferSize = AcpiGbl_ResourceStructSerialBusSizes [
830
- CommonSerialBus .Type ] + ExtraStructBytes ;
821
+ AmlResource -> CommonSerialBus .Type ] + ExtraStructBytes ;
831
822
}
832
823
else
833
824
{
Original file line number Diff line number Diff line change @@ -209,12 +209,7 @@ AcpiRsConvertAmlToResources (
209
209
if (AcpiUtGetResourceType (Aml ) ==
210
210
ACPI_RESOURCE_NAME_SERIAL_BUS )
211
211
{
212
- /* Avoid undefined behavior: member access within misaligned address */
213
-
214
- AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus ;
215
- memcpy (& CommonSerialBus , AmlResource , sizeof (CommonSerialBus ));
216
-
217
- if (CommonSerialBus .Type >
212
+ if (AmlResource -> CommonSerialBus .Type >
218
213
AML_RESOURCE_MAX_SERIALBUSTYPE )
219
214
{
220
215
ConversionTable = NULL ;
@@ -224,7 +219,7 @@ AcpiRsConvertAmlToResources (
224
219
/* This is an I2C, SPI, UART, or CSI2 SerialBus descriptor */
225
220
226
221
ConversionTable = AcpiGbl_ConvertResourceSerialBusDispatch [
227
- CommonSerialBus .Type ];
222
+ AmlResource -> CommonSerialBus .Type ];
228
223
}
229
224
}
230
225
else
Original file line number Diff line number Diff line change @@ -532,21 +532,16 @@ AcpiUtValidateResource (
532
532
AmlResource = ACPI_CAST_PTR (AML_RESOURCE , Aml );
533
533
if (ResourceType == ACPI_RESOURCE_NAME_SERIAL_BUS )
534
534
{
535
- /* Avoid undefined behavior: member access within misaligned address */
536
-
537
- AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus ;
538
- memcpy (& CommonSerialBus , AmlResource , sizeof (CommonSerialBus ));
539
-
540
535
/* Validate the BusType field */
541
536
542
- if ((CommonSerialBus .Type == 0 ) ||
543
- (CommonSerialBus .Type > AML_RESOURCE_MAX_SERIALBUSTYPE ))
537
+ if ((AmlResource -> CommonSerialBus .Type == 0 ) ||
538
+ (AmlResource -> CommonSerialBus .Type > AML_RESOURCE_MAX_SERIALBUSTYPE ))
544
539
{
545
540
if (WalkState )
546
541
{
547
542
ACPI_ERROR ((AE_INFO ,
548
543
"Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X" ,
549
- CommonSerialBus .Type ));
544
+ AmlResource -> CommonSerialBus .Type ));
550
545
}
551
546
return (AE_AML_INVALID_RESOURCE_TYPE );
552
547
}
Original file line number Diff line number Diff line change @@ -792,10 +792,6 @@ typedef struct aml_resource_pin_group_config
792
792
793
793
#define AML_RESOURCE_PIN_GROUP_CONFIG_REVISION 1 /* ACPI 6.2 */
794
794
795
- /* restore default alignment */
796
-
797
- #pragma pack()
798
-
799
795
/* Union of all resource descriptors, so we can allocate the worst case */
800
796
801
797
typedef union aml_resource
@@ -852,6 +848,9 @@ typedef union aml_resource
852
848
853
849
} AML_RESOURCE ;
854
850
851
+ /* restore default alignment */
852
+
853
+ #pragma pack()
855
854
856
855
/* Interfaces used by both the disassembler and compiler */
857
856
You can’t perform that action at this time.
0 commit comments