diff options
author | Bob Moore <robert.moore@intel.com> | 2008-09-27 13:27:51 +0800 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-10-22 23:14:50 -0400 |
commit | 4ca846e9270f305ad19e61f6654664f31459f332 (patch) | |
tree | ecea9b480c8fc02ffed9de7865ed4394908501d2 /drivers/acpi | |
parent | e8707b340fb5b6313cde784b944a568dfd770ddd (diff) |
ACPICA: Add support for zero-length buffer-to-string conversions
Allow zero length strings during interpreter buffer-to-string
conversions. For example, during the ToDecimalString and
ToHexString operaters, as well as implicit conversions. Fiodor
Suietov. ACPICA BZ 585.
http://www.acpica.org/bugzilla/show_bug.cgi?id=585
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')
-rw-r--r-- | drivers/acpi/executer/exconvrt.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 890378e789a4..1d1f35adddde 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c @@ -512,9 +512,14 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, /* * Create a new string object and string buffer * (-1 because of extra separator included in string_length from above) + * Allow creation of zero-length strings from zero-length buffers. */ + if (string_length) { + string_length--; + } + return_desc = acpi_ut_create_string_object((acpi_size) - (string_length - 1)); + string_length); if (!return_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -537,7 +542,9 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, * Null terminate the string * (overwrites final comma/space from above) */ - new_buf--; + if (obj_desc->buffer.length) { + new_buf--; + } *new_buf = 0; break; |