Commit 498fbb5d411fc8f6207c210796c9308bf54a51a5
Committed by
Greg Kroah-Hartman
1 parent
e80af3a8db
Exists in
master
and in
7 other branches
PCI: hotplug: acpiphp_ibm: Remove get device information
drivers/pci/hotplug/acpiphp_ibm.c:ibm_find_acpi_device() is not large enough to accommodate data returned by the _CID method executed from acpi_get_object_info(). This patch eliminates the problem by letting ACPI code (instead of driver code) determine and obtain a correctly sized buffer. Signed-off-by: Gary Hade <garyhade@us.ibm.com> Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 1 changed file with 17 additions and 16 deletions Side-by-side Diff
drivers/pci/hotplug/acpiphp_ibm.c
... | ... | @@ -395,33 +395,34 @@ |
395 | 395 | { |
396 | 396 | acpi_handle *phandle = (acpi_handle *)context; |
397 | 397 | acpi_status status; |
398 | - struct acpi_device_info info; | |
399 | - struct acpi_buffer info_buffer = { | |
400 | - .length = sizeof(struct acpi_device_info), | |
401 | - .pointer = &info, | |
402 | - }; | |
398 | + struct acpi_device_info *info; | |
399 | + struct acpi_buffer info_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | |
400 | + int retval = 0; | |
403 | 401 | |
404 | 402 | status = acpi_get_object_info(handle, &info_buffer); |
405 | 403 | if (ACPI_FAILURE(status)) { |
406 | - err("%s: Failed to get device information\n", __FUNCTION__); | |
407 | - return 0; | |
404 | + err("%s: Failed to get device information status=0x%x\n", | |
405 | + __FUNCTION__, status); | |
406 | + return retval; | |
408 | 407 | } |
409 | - info.hardware_id.value[sizeof(info.hardware_id.value) - 1] = '\0'; | |
408 | + info = info_buffer.pointer; | |
409 | + info->hardware_id.value[sizeof(info->hardware_id.value) - 1] = '\0'; | |
410 | 410 | |
411 | - if (info.current_status && (info.valid & ACPI_VALID_HID) && | |
412 | - (!strcmp(info.hardware_id.value, IBM_HARDWARE_ID1) || | |
413 | - !strcmp(info.hardware_id.value, IBM_HARDWARE_ID2))) { | |
414 | - dbg("found hardware: %s, handle: %p\n", info.hardware_id.value, | |
415 | - handle); | |
411 | + if (info->current_status && (info->valid & ACPI_VALID_HID) && | |
412 | + (!strcmp(info->hardware_id.value, IBM_HARDWARE_ID1) || | |
413 | + !strcmp(info->hardware_id.value, IBM_HARDWARE_ID2))) { | |
414 | + dbg("found hardware: %s, handle: %p\n", | |
415 | + info->hardware_id.value, handle); | |
416 | 416 | *phandle = handle; |
417 | 417 | /* returning non-zero causes the search to stop |
418 | 418 | * and returns this value to the caller of |
419 | 419 | * acpi_walk_namespace, but it also causes some warnings |
420 | 420 | * in the acpi debug code to print... |
421 | 421 | */ |
422 | - return FOUND_APCI; | |
422 | + retval = FOUND_APCI; | |
423 | 423 | } |
424 | - return 0; | |
424 | + kfree(info); | |
425 | + return retval; | |
425 | 426 | } |
426 | 427 | |
427 | 428 | static int __init ibm_acpiphp_init(void) |