From d70971c80b0c8836b5abf015f6807ee60a6c9afc Mon Sep 17 00:00:00 2001 From: Alexey Starikovskiy Date: Thu, 1 Apr 2010 11:06:34 +0800 Subject: [PATCH] --- yaml --- r: 193487 b: refs/heads/master c: 333b04ae338e3421297d46c508f053a6767d2883 h: refs/heads/master i: 193485: 81129342d690c66f9bb8b9179ae900f5d183fd97 193483: 12166cbdc6571cbdaf7623266b7bf0826aaec48f 193479: d407ce6fdf36e43f83c8d817169a995e6a15a1dc 193471: 5560c5a9b90868c983b5e299cd35639a07341b90 v: v3 --- [refs] | 2 +- trunk/drivers/acpi/acpica/tbxface.c | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index ed698a3fc2c0..f04d4d1f991f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a7499bc84eabb200f9dc23770a46d9a31b1e763a +refs/heads/master: 333b04ae338e3421297d46c508f053a6767d2883 diff --git a/trunk/drivers/acpi/acpica/tbxface.c b/trunk/drivers/acpi/acpica/tbxface.c index 5217a6159a31..684614d0d327 100644 --- a/trunk/drivers/acpi/acpica/tbxface.c +++ b/trunk/drivers/acpi/acpica/tbxface.c @@ -172,6 +172,7 @@ acpi_status acpi_reallocate_root_table(void) { struct acpi_table_desc *tables; acpi_size new_size; + acpi_size current_size; ACPI_FUNCTION_TRACE(acpi_reallocate_root_table); @@ -183,9 +184,15 @@ acpi_status acpi_reallocate_root_table(void) return_ACPI_STATUS(AE_SUPPORT); } - new_size = ((acpi_size) acpi_gbl_root_table_list.count + - ACPI_ROOT_TABLE_SIZE_INCREMENT) * - sizeof(struct acpi_table_desc); + /* + * Get the current size of the root table and add the default + * increment to create the new table size. + */ + current_size = (acpi_size) + acpi_gbl_root_table_list.count * sizeof(struct acpi_table_desc); + + new_size = current_size + + (ACPI_ROOT_TABLE_SIZE_INCREMENT * sizeof(struct acpi_table_desc)); /* Create new array and copy the old array */ @@ -194,10 +201,16 @@ acpi_status acpi_reallocate_root_table(void) return_ACPI_STATUS(AE_NO_MEMORY); } - ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, new_size); + ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, current_size); - acpi_gbl_root_table_list.size = acpi_gbl_root_table_list.count; + /* + * Update the root table descriptor. The new size will be the current + * number of tables plus the increment, independent of the reserved + * size of the original table list. + */ acpi_gbl_root_table_list.tables = tables; + acpi_gbl_root_table_list.size = + acpi_gbl_root_table_list.count + ACPI_ROOT_TABLE_SIZE_INCREMENT; acpi_gbl_root_table_list.flags = ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE;