aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exconvrt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exconvrt.c')
-rw-r--r--drivers/acpi/executer/exconvrt.c11
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,
512 /* 512 /*
513 * Create a new string object and string buffer 513 * Create a new string object and string buffer
514 * (-1 because of extra separator included in string_length from above) 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 return_desc = acpi_ut_create_string_object((acpi_size) 521 return_desc = acpi_ut_create_string_object((acpi_size)
517 (string_length - 1)); 522 string_length);
518 if (!return_desc) { 523 if (!return_desc) {
519 return_ACPI_STATUS(AE_NO_MEMORY); 524 return_ACPI_STATUS(AE_NO_MEMORY);
520 } 525 }
@@ -537,7 +542,9 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
537 * Null terminate the string 542 * Null terminate the string
538 * (overwrites final comma/space from above) 543 * (overwrites final comma/space from above)
539 */ 544 */
540 new_buf--; 545 if (obj_desc->buffer.length) {
546 new_buf--;
547 }
541 *new_buf = 0; 548 *new_buf = 0;
542 break; 549 break;
543 550