summaryrefslogtreecommitdiff
path: root/drivers/acpi/acpica/hwxface.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2009-02-18 09:28:02 +0300
committerLen Brown <len.brown@intel.com>2009-03-26 23:38:25 +0300
commitac0c84502697114a378057eed83a9baba879cfc9 (patch)
tree83d1533a4783e6b5ffe5385a7dead57f1dfcf7bb /drivers/acpi/acpica/hwxface.c
parentaefc7f9a0220a40beff9b6b3b320cbeae128d0e3 (diff)
downloadlinux-ac0c84502697114a378057eed83a9baba879cfc9.tar.xz
ACPICA: Fix parameter validation for acpi_read/write
Now return AE_BAD_PARAMETER if the input register pointer is null, and AE_BAD_ADDRESS if the register has an address of zero. Previously, these cases simply returned AE_OK. For optional registers such as PM1B status/enable/control, the caller should check for a valid register address before calling. ACPICA BZ 748. http://www.acpica.org/bugzilla/show_bug.cgi?id=748 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/hwxface.c')
-rw-r--r--drivers/acpi/acpica/hwxface.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index ae597c0ab53f..f67562ea0010 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -107,19 +107,18 @@ acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg)
ACPI_FUNCTION_NAME(acpi_read);
/*
- * Must have a valid pointer to a GAS structure, and
- * a non-zero address within. However, don't return an error
- * because the PM1A/B code must not fail if B isn't present.
+ * Must have a valid pointer to a GAS structure, and a non-zero address
+ * within.
*/
if (!reg) {
- return (AE_OK);
+ return (AE_BAD_PARAMETER);
}
/* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64(&address, &reg->address);
if (!address) {
- return (AE_OK);
+ return (AE_BAD_ADDRESS);
}
/* Supported widths are 8/16/32 */
@@ -187,19 +186,18 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg)
ACPI_FUNCTION_NAME(acpi_write);
/*
- * Must have a valid pointer to a GAS structure, and
- * a non-zero address within. However, don't return an error
- * because the PM1A/B code must not fail if B isn't present.
+ * Must have a valid pointer to a GAS structure, and a non-zero address
+ * within.
*/
if (!reg) {
- return (AE_OK);
+ return (AE_BAD_PARAMETER);
}
/* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64(&address, &reg->address);
if (!address) {
- return (AE_OK);
+ return (AE_BAD_ADDRESS);
}
/* Supported widths are 8/16/32 */