diff options
author | Bob Moore <robert.moore@intel.com> | 2008-04-10 11:06:39 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-22 14:29:25 -0400 |
commit | 98af37fba9b3e601ca4bded51ef51a2be4e8c97b (patch) | |
tree | 8a162d4b1950935570081f59e500086795362558 /drivers | |
parent | a13b8460c5b43a68192b599ce437168cc2ff04de (diff) |
ACPICA: Add a table checksum verify for Load operator
Added a table checksum verification for the Load operator, in
the case where the load is from a buffer.
http://www.acpica.org/bugzilla/show_bug.cgi?id=578
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/executer/exconfig.c | 24 | ||||
-rw-r--r-- | drivers/acpi/tables/tbutils.c | 2 |
2 files changed, 22 insertions, 4 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index a0f34b467a22..dbf1e6f33bba 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -275,6 +275,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
275 | struct acpi_table_desc table_desc; | 275 | struct acpi_table_desc table_desc; |
276 | acpi_native_uint table_index; | 276 | acpi_native_uint table_index; |
277 | acpi_status status; | 277 | acpi_status status; |
278 | u32 length; | ||
278 | 279 | ||
279 | ACPI_FUNCTION_TRACE(ex_load_op); | 280 | ACPI_FUNCTION_TRACE(ex_load_op); |
280 | 281 | ||
@@ -322,18 +323,35 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
322 | "Load from Buffer or Field %p %s\n", obj_desc, | 323 | "Load from Buffer or Field %p %s\n", obj_desc, |
323 | acpi_ut_get_object_type_name(obj_desc))); | 324 | acpi_ut_get_object_type_name(obj_desc))); |
324 | 325 | ||
326 | length = obj_desc->buffer.length; | ||
327 | |||
328 | /* Must have at least an ACPI table header */ | ||
329 | |||
330 | if (length < sizeof(struct acpi_table_header)) { | ||
331 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); | ||
332 | } | ||
333 | |||
334 | /* Validate checksum here. It won't get validated in tb_add_table */ | ||
335 | |||
336 | status = acpi_tb_verify_checksum((struct acpi_table_header *) | ||
337 | obj_desc->buffer.pointer, | ||
338 | length); | ||
339 | if (ACPI_FAILURE(status)) { | ||
340 | return_ACPI_STATUS(status); | ||
341 | } | ||
342 | |||
325 | /* | 343 | /* |
326 | * We need to copy the buffer since the original buffer could be | 344 | * We need to copy the buffer since the original buffer could be |
327 | * changed or deleted in the future | 345 | * changed or deleted in the future |
328 | */ | 346 | */ |
329 | table_desc.pointer = ACPI_ALLOCATE(obj_desc->buffer.length); | 347 | table_desc.pointer = ACPI_ALLOCATE(length); |
330 | if (!table_desc.pointer) { | 348 | if (!table_desc.pointer) { |
331 | return_ACPI_STATUS(AE_NO_MEMORY); | 349 | return_ACPI_STATUS(AE_NO_MEMORY); |
332 | } | 350 | } |
333 | 351 | ||
334 | ACPI_MEMCPY(table_desc.pointer, obj_desc->buffer.pointer, | 352 | ACPI_MEMCPY(table_desc.pointer, obj_desc->buffer.pointer, |
335 | obj_desc->buffer.length); | 353 | length); |
336 | table_desc.length = obj_desc->buffer.length; | 354 | table_desc.length = length; |
337 | table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED; | 355 | table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED; |
338 | break; | 356 | break; |
339 | 357 | ||
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 010f19652f80..d04442fc4955 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -212,7 +212,7 @@ acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length) | |||
212 | 212 | ||
213 | if (checksum) { | 213 | if (checksum) { |
214 | ACPI_WARNING((AE_INFO, | 214 | ACPI_WARNING((AE_INFO, |
215 | "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", | 215 | "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", |
216 | table->signature, table->checksum, | 216 | table->signature, table->checksum, |
217 | (u8) (table->checksum - checksum))); | 217 | (u8) (table->checksum - checksum))); |
218 | 218 | ||