Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+9 -9
+8 -8
drivers/acpi/osl.c
··· 623 623 624 624 acpi_status 625 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 628 int result, size; 629 629 ··· 689 689 acpi_status status; 690 690 unsigned long temp; 691 691 acpi_object_type type; 692 - u8 tu8; 693 692 694 693 acpi_get_parent(chandle, &handle); 695 694 if (handle != rhandle) { ··· 703 704 acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, 704 705 &temp); 705 706 if (ACPI_SUCCESS(status)) { 707 + u32 val; 706 708 pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp)); 707 709 pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp)); 708 710 ··· 712 712 713 713 /* any nicer way to get bus number of bridge ? */ 714 714 status = 715 - acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, 715 + acpi_os_read_pci_configuration(pci_id, 0x0e, &val, 716 716 8); 717 717 if (ACPI_SUCCESS(status) 718 - && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) { 718 + && ((val & 0x7f) == 1 || (val & 0x7f) == 2)) { 719 719 status = 720 720 acpi_os_read_pci_configuration(pci_id, 0x18, 721 - &tu8, 8); 721 + &val, 8); 722 722 if (!ACPI_SUCCESS(status)) { 723 723 /* Certainly broken... FIX ME */ 724 724 return; 725 725 } 726 726 *is_bridge = 1; 727 - pci_id->bus = tu8; 727 + pci_id->bus = val; 728 728 status = 729 729 acpi_os_read_pci_configuration(pci_id, 0x19, 730 - &tu8, 8); 730 + &val, 8); 731 731 if (ACPI_SUCCESS(status)) { 732 - *bus_number = tu8; 732 + *bus_number = val; 733 733 } 734 734 } else 735 735 *is_bridge = 0;
+1 -1
include/acpi/acpiosxf.h
··· 222 222 */ 223 223 acpi_status 224 224 acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, 225 - u32 reg, void *value, u32 width); 225 + u32 reg, u32 *value, u32 width); 226 226 227 227 acpi_status 228 228 acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,