Skip to content

Commit

Permalink
ACPICA: ACPICA: add status check for acpi_hw_read before assigning re…
Browse files Browse the repository at this point in the history
…turn value

The value coming from acpi_hw_read() should not be used if it
returns an error code, so check the status returned by it before
using that value in two places in acpi_hw_register_read().

Reported-by: Mark Gross <mark.gross@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Erik Schmauss authored and Rafael J. Wysocki committed Aug 14, 2018
1 parent d46b653 commit f016b19
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/acpi/acpica/hwregs.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,18 @@ acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value)

status =
acpi_hw_read(&value64, &acpi_gbl_FADT.xpm2_control_block);
value = (u32)value64;
if (ACPI_SUCCESS(status)) {
value = (u32)value64;
}
break;

case ACPI_REGISTER_PM_TIMER: /* 32-bit access */

status = acpi_hw_read(&value64, &acpi_gbl_FADT.xpm_timer_block);
value = (u32)value64;
if (ACPI_SUCCESS(status)) {
value = (u32)value64;
}

break;

case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
Expand Down

0 comments on commit f016b19

Please sign in to comment.