diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-13 12:56:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-13 12:56:14 -0500 |
commit | 10270d4838bdc493781f5a1cf2e90e9c34c9142f (patch) | |
tree | d9bce90a79be42ffd619b65b42e9a699bf0d13a6 /drivers/acpi/osl.c | |
parent | d897d2b597167586fcf1fb197ad5a1c23332c3e8 (diff) |
acpi: fix acpi_os_read_pci_configuration() misuse of raw_pci_read()
The raw_pci_read() interface (as the raw_pci_ops->read() before it)
unconditionally fills in a 32-bit integer return value regardless of the
size of the operation requested.
So claiming to take a "void *" is wrong, as is passing in a pointer to
just a byte variable.
Noticed by pageexec when enabling -fstack-protector (which needs other
patches too to actually work, but that's a separate issue).
Acked-by: Len Brown <len.brown@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r-- | drivers/acpi/osl.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 34b3386dedca..15e602377655 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -623,7 +623,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) | |||
623 | 623 | ||
624 | acpi_status | 624 | acpi_status |
625 | acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | 625 | acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, |
626 | void *value, u32 width) | 626 | u32 *value, u32 width) |
627 | { | 627 | { |
628 | int result, size; | 628 | int result, size; |
629 | 629 | ||
@@ -689,7 +689,6 @@ static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */ | |||
689 | acpi_status status; | 689 | acpi_status status; |
690 | unsigned long temp; | 690 | unsigned long temp; |
691 | acpi_object_type type; | 691 | acpi_object_type type; |
692 | u8 tu8; | ||
693 | 692 | ||
694 | acpi_get_parent(chandle, &handle); | 693 | acpi_get_parent(chandle, &handle); |
695 | if (handle != rhandle) { | 694 | if (handle != rhandle) { |
@@ -704,6 +703,7 @@ static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */ | |||
704 | acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, | 703 | acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, |
705 | &temp); | 704 | &temp); |
706 | if (ACPI_SUCCESS(status)) { | 705 | if (ACPI_SUCCESS(status)) { |
706 | u32 val; | ||
707 | pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp)); | 707 | pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp)); |
708 | pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp)); | 708 | pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp)); |
709 | 709 | ||
@@ -712,24 +712,24 @@ static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */ | |||
712 | 712 | ||
713 | /* any nicer way to get bus number of bridge ? */ | 713 | /* any nicer way to get bus number of bridge ? */ |
714 | status = | 714 | status = |
715 | acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, | 715 | acpi_os_read_pci_configuration(pci_id, 0x0e, &val, |
716 | 8); | 716 | 8); |
717 | if (ACPI_SUCCESS(status) | 717 | if (ACPI_SUCCESS(status) |
718 | && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) { | 718 | && ((val & 0x7f) == 1 || (val & 0x7f) == 2)) { |
719 | status = | 719 | status = |
720 | acpi_os_read_pci_configuration(pci_id, 0x18, | 720 | acpi_os_read_pci_configuration(pci_id, 0x18, |
721 | &tu8, 8); | 721 | &val, 8); |
722 | if (!ACPI_SUCCESS(status)) { | 722 | if (!ACPI_SUCCESS(status)) { |
723 | /* Certainly broken... FIX ME */ | 723 | /* Certainly broken... FIX ME */ |
724 | return; | 724 | return; |
725 | } | 725 | } |
726 | *is_bridge = 1; | 726 | *is_bridge = 1; |
727 | pci_id->bus = tu8; | 727 | pci_id->bus = val; |
728 | status = | 728 | status = |
729 | acpi_os_read_pci_configuration(pci_id, 0x19, | 729 | acpi_os_read_pci_configuration(pci_id, 0x19, |
730 | &tu8, 8); | 730 | &val, 8); |
731 | if (ACPI_SUCCESS(status)) { | 731 | if (ACPI_SUCCESS(status)) { |
732 | *bus_number = tu8; | 732 | *bus_number = val; |
733 | } | 733 | } |
734 | } else | 734 | } else |
735 | *is_bridge = 0; | 735 | *is_bridge = 0; |