diff options
author | Bob Moore <robert.moore@intel.com> | 2009-02-18 01:28:02 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-03-26 16:38:25 -0400 |
commit | ac0c84502697114a378057eed83a9baba879cfc9 (patch) | |
tree | 83d1533a4783e6b5ffe5385a7dead57f1dfcf7bb /drivers/acpi/acpica | |
parent | aefc7f9a0220a40beff9b6b3b320cbeae128d0e3 (diff) |
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')
-rw-r--r-- | drivers/acpi/acpica/hwxface.c | 18 |
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) | |||
107 | ACPI_FUNCTION_NAME(acpi_read); | 107 | ACPI_FUNCTION_NAME(acpi_read); |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * Must have a valid pointer to a GAS structure, and | 110 | * Must have a valid pointer to a GAS structure, and a non-zero address |
111 | * a non-zero address within. However, don't return an error | 111 | * within. |
112 | * because the PM1A/B code must not fail if B isn't present. | ||
113 | */ | 112 | */ |
114 | if (!reg) { | 113 | if (!reg) { |
115 | return (AE_OK); | 114 | return (AE_BAD_PARAMETER); |
116 | } | 115 | } |
117 | 116 | ||
118 | /* Get a local copy of the address. Handles possible alignment issues */ | 117 | /* Get a local copy of the address. Handles possible alignment issues */ |
119 | 118 | ||
120 | ACPI_MOVE_64_TO_64(&address, ®->address); | 119 | ACPI_MOVE_64_TO_64(&address, ®->address); |
121 | if (!address) { | 120 | if (!address) { |
122 | return (AE_OK); | 121 | return (AE_BAD_ADDRESS); |
123 | } | 122 | } |
124 | 123 | ||
125 | /* Supported widths are 8/16/32 */ | 124 | /* Supported widths are 8/16/32 */ |
@@ -187,19 +186,18 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg) | |||
187 | ACPI_FUNCTION_NAME(acpi_write); | 186 | ACPI_FUNCTION_NAME(acpi_write); |
188 | 187 | ||
189 | /* | 188 | /* |
190 | * Must have a valid pointer to a GAS structure, and | 189 | * Must have a valid pointer to a GAS structure, and a non-zero address |
191 | * a non-zero address within. However, don't return an error | 190 | * within. |
192 | * because the PM1A/B code must not fail if B isn't present. | ||
193 | */ | 191 | */ |
194 | if (!reg) { | 192 | if (!reg) { |
195 | return (AE_OK); | 193 | return (AE_BAD_PARAMETER); |
196 | } | 194 | } |
197 | 195 | ||
198 | /* Get a local copy of the address. Handles possible alignment issues */ | 196 | /* Get a local copy of the address. Handles possible alignment issues */ |
199 | 197 | ||
200 | ACPI_MOVE_64_TO_64(&address, ®->address); | 198 | ACPI_MOVE_64_TO_64(&address, ®->address); |
201 | if (!address) { | 199 | if (!address) { |
202 | return (AE_OK); | 200 | return (AE_BAD_ADDRESS); |
203 | } | 201 | } |
204 | 202 | ||
205 | /* Supported widths are 8/16/32 */ | 203 | /* Supported widths are 8/16/32 */ |