Commit 4ca846e9270f305ad19e61f6654664f31459f332
Committed by
Len Brown
1 parent
e8707b340f
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 9 additions and 2 deletions Side-by-side Diff
drivers/acpi/executer/exconvrt.c
... | ... | @@ -512,9 +512,14 @@ |
512 | 512 | /* |
513 | 513 | * Create a new string object and string buffer |
514 | 514 | * (-1 because of extra separator included in string_length from above) |
515 | + * Allow creation of zero-length strings from zero-length buffers. | |
515 | 516 | */ |
517 | + if (string_length) { | |
518 | + string_length--; | |
519 | + } | |
520 | + | |
516 | 521 | return_desc = acpi_ut_create_string_object((acpi_size) |
517 | - (string_length - 1)); | |
522 | + string_length); | |
518 | 523 | if (!return_desc) { |
519 | 524 | return_ACPI_STATUS(AE_NO_MEMORY); |
520 | 525 | } |
... | ... | @@ -537,7 +542,9 @@ |
537 | 542 | * Null terminate the string |
538 | 543 | * (overwrites final comma/space from above) |
539 | 544 | */ |
540 | - new_buf--; | |
545 | + if (obj_desc->buffer.length) { | |
546 | + new_buf--; | |
547 | + } | |
541 | 548 | *new_buf = 0; |
542 | 549 | break; |
543 | 550 |