summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utils.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-25 23:39:25 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-25 23:39:25 +0200
commit17e8d03c485931b198fd24b69d19247053f58626 (patch)
treee8d02dd022fae645e1d1d71d8f93e742b62a22e3 /drivers/acpi/utils.c
parente37f14a5fb85522f3bbf88ece6134c4e610ed598 (diff)
parent5e2be4e0edff4a1021b6743ca6859129cd8e7067 (diff)
Merge back earlier 'acpi-assorted' material.
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r--drivers/acpi/utils.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 552248b0005..fc2cd328408 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -169,11 +169,20 @@ acpi_extract_package(union acpi_object *package,
/*
* Validate output buffer.
*/
- if (buffer->length < size_required) {
+ if (buffer->length == ACPI_ALLOCATE_BUFFER) {
+ buffer->pointer = ACPI_ALLOCATE(size_required);
+ if (!buffer->pointer)
+ return AE_NO_MEMORY;
buffer->length = size_required;
- return AE_BUFFER_OVERFLOW;
- } else if (buffer->length != size_required || !buffer->pointer) {
- return AE_BAD_PARAMETER;
+ memset(buffer->pointer, 0, size_required);
+ } else {
+ if (buffer->length < size_required) {
+ buffer->length = size_required;
+ return AE_BUFFER_OVERFLOW;
+ } else if (buffer->length != size_required ||
+ !buffer->pointer) {
+ return AE_BAD_PARAMETER;
+ }
}
head = buffer->pointer;