diff options
-rw-r--r-- | drivers/acpi/acpica/utcopy.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index 97ec3621e71d..6fef83f04bcd 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c | |||
@@ -677,16 +677,24 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
677 | u16 reference_count; | 677 | u16 reference_count; |
678 | union acpi_operand_object *next_object; | 678 | union acpi_operand_object *next_object; |
679 | acpi_status status; | 679 | acpi_status status; |
680 | acpi_size copy_size; | ||
680 | 681 | ||
681 | /* Save fields from destination that we don't want to overwrite */ | 682 | /* Save fields from destination that we don't want to overwrite */ |
682 | 683 | ||
683 | reference_count = dest_desc->common.reference_count; | 684 | reference_count = dest_desc->common.reference_count; |
684 | next_object = dest_desc->common.next_object; | 685 | next_object = dest_desc->common.next_object; |
685 | 686 | ||
686 | /* Copy the entire source object over the destination object */ | 687 | /* |
688 | * Copy the entire source object over the destination object. | ||
689 | * Note: Source can be either an operand object or namespace node. | ||
690 | */ | ||
691 | copy_size = sizeof(union acpi_operand_object); | ||
692 | if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_NAMED) { | ||
693 | copy_size = sizeof(struct acpi_namespace_node); | ||
694 | } | ||
687 | 695 | ||
688 | ACPI_MEMCPY((char *)dest_desc, (char *)source_desc, | 696 | ACPI_MEMCPY(ACPI_CAST_PTR(char, dest_desc), |
689 | sizeof(union acpi_operand_object)); | 697 | ACPI_CAST_PTR(char, source_desc), copy_size); |
690 | 698 | ||
691 | /* Restore the saved fields */ | 699 | /* Restore the saved fields */ |
692 | 700 | ||