On Wed, Sep 11, 2013 at 10:10:19AM -0600, Al Stone wrote:
On 09/11/2013 03:33 AM, Graeme Gregory wrote:
On Fri, Sep 06, 2013 at 10:59:30AM -0600, al.stone@linaro.org wrote:
From: Al Stone ahs3@redhat.com
The current version requires one to know the size of the package a priori; this is almost impossible if the package is composed of strings of variable length. This change allows the utility to allocate a buffer of the proper size if asked.
Signed-off-by: Al Stone al.stone@linaro.org
drivers/acpi/utils.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 74437130..bcb78f1 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);
This worries me as its an API change, who is responsible for freeing this memory?
Understandably. Since this is new functionality, there should be no effect on existing code.
This is also the same behavior as the other acpi_extract_*() calls; i.e., the caller is responsible for the ACPI_FREE() invocation. I guess I see this as more of a completion of the API as a result.
In light of the decision at Plumbers to start using _DSM for misc data values has this been sent upstream?
Graeme
if (!buffer->pointer)
buffer->length = size_required;return AE_NO_MEMORY;
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;
-- 1.8.3.1
Linaro-acpi mailing list Linaro-acpi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-acpi
-- ciao, al
Al Stone Software Engineer Linaro Enterprise Group al.stone@linaro.org