aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exstorob.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exstorob.c')
-rw-r--r--drivers/acpi/executer/exstorob.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c
index 6ab707087750..99ebe5adfcda 100644
--- a/drivers/acpi/executer/exstorob.c
+++ b/drivers/acpi/executer/exstorob.c
@@ -67,7 +67,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
67 u32 length; 67 u32 length;
68 u8 *buffer; 68 u8 *buffer;
69 69
70 ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc); 70 ACPI_FUNCTION_TRACE_PTR(ex_store_buffer_to_buffer, source_desc);
71 71
72 /* We know that source_desc is a buffer by now */ 72 /* We know that source_desc is a buffer by now */
73 73
@@ -80,7 +80,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
80 */ 80 */
81 if ((target_desc->buffer.length == 0) || 81 if ((target_desc->buffer.length == 0) ||
82 (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { 82 (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) {
83 target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length); 83 target_desc->buffer.pointer = ACPI_ALLOCATE(length);
84 if (!target_desc->buffer.pointer) { 84 if (!target_desc->buffer.pointer) {
85 return_ACPI_STATUS(AE_NO_MEMORY); 85 return_ACPI_STATUS(AE_NO_MEMORY);
86 } 86 }
@@ -91,6 +91,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
91 /* Copy source buffer to target buffer */ 91 /* Copy source buffer to target buffer */
92 92
93 if (length <= target_desc->buffer.length) { 93 if (length <= target_desc->buffer.length) {
94
94 /* Clear existing buffer and copy in the new one */ 95 /* Clear existing buffer and copy in the new one */
95 96
96 ACPI_MEMSET(target_desc->buffer.pointer, 0, 97 ACPI_MEMSET(target_desc->buffer.pointer, 0,
@@ -102,7 +103,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
102 * NOTE: ACPI versions up to 3.0 specified that the buffer must be 103 * NOTE: ACPI versions up to 3.0 specified that the buffer must be
103 * truncated if the string is smaller than the buffer. However, "other" 104 * truncated if the string is smaller than the buffer. However, "other"
104 * implementations of ACPI never did this and thus became the defacto 105 * implementations of ACPI never did this and thus became the defacto
105 * standard. ACPi 3.0_a changes this behavior such that the buffer 106 * standard. ACPI 3.0_a changes this behavior such that the buffer
106 * is no longer truncated. 107 * is no longer truncated.
107 */ 108 */
108 109
@@ -113,6 +114,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
113 * copy must not truncate the original buffer. 114 * copy must not truncate the original buffer.
114 */ 115 */
115 if (original_src_type == ACPI_TYPE_STRING) { 116 if (original_src_type == ACPI_TYPE_STRING) {
117
116 /* Set the new length of the target */ 118 /* Set the new length of the target */
117 119
118 target_desc->buffer.length = length; 120 target_desc->buffer.length = length;
@@ -156,7 +158,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
156 u32 length; 158 u32 length;
157 u8 *buffer; 159 u8 *buffer;
158 160
159 ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc); 161 ACPI_FUNCTION_TRACE_PTR(ex_store_string_to_string, source_desc);
160 162
161 /* We know that source_desc is a string by now */ 163 /* We know that source_desc is a string by now */
162 164
@@ -183,13 +185,14 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
183 */ 185 */
184 if (target_desc->string.pointer && 186 if (target_desc->string.pointer &&
185 (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { 187 (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
188
186 /* Only free if not a pointer into the DSDT */ 189 /* Only free if not a pointer into the DSDT */
187 190
188 ACPI_MEM_FREE(target_desc->string.pointer); 191 ACPI_FREE(target_desc->string.pointer);
189 } 192 }
190 193
191 target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size) 194 target_desc->string.pointer = ACPI_ALLOCATE_ZEROED((acpi_size)
192 length + 1); 195 length + 1);
193 if (!target_desc->string.pointer) { 196 if (!target_desc->string.pointer) {
194 return_ACPI_STATUS(AE_NO_MEMORY); 197 return_ACPI_STATUS(AE_NO_MEMORY);
195 } 198 }