--- zzzz-none-000/linux-3.10.107/drivers/acpi/acpica/uttrack.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/acpi/acpica/uttrack.c 2021-02-04 17:41:59.000000000 +0000 @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2013, Intel Corp. + * Copyright (C) 2000 - 2015, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,7 +100,7 @@ return (AE_NO_MEMORY); } - ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); + memset(cache, 0, sizeof(struct acpi_memory_list)); cache->list_name = list_name; cache->object_size = object_size; @@ -130,10 +130,23 @@ struct acpi_debug_mem_block *allocation; acpi_status status; + /* Check for an inadvertent size of zero bytes */ + + if (!size) { + ACPI_WARNING((module, line, + "Attempt to allocate zero bytes, allocating 1 byte")); + size = 1; + } + allocation = - acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header), - component, module, line); + acpi_os_allocate(size + sizeof(struct acpi_debug_mem_header)); if (!allocation) { + + /* Report allocation error */ + + ACPI_WARNING((module, line, + "Could not allocate size %u", (u32)size)); + return (NULL); } @@ -179,9 +192,17 @@ struct acpi_debug_mem_block *allocation; acpi_status status; + /* Check for an inadvertent size of zero bytes */ + + if (!size) { + ACPI_WARNING((module, line, + "Attempt to allocate zero bytes, allocating 1 byte")); + size = 1; + } + allocation = - acpi_ut_allocate_zeroed(size + sizeof(struct acpi_debug_mem_header), - component, module, line); + acpi_os_allocate_zeroed(size + + sizeof(struct acpi_debug_mem_header)); if (!allocation) { /* Report allocation error */ @@ -255,7 +276,8 @@ } acpi_os_free(debug_block); - ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed (block %p)\n", + allocation, debug_block)); return_VOID; } @@ -380,7 +402,7 @@ allocation->component = component; allocation->line = line; - ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME); + strncpy(allocation->module, module, ACPI_MAX_MODULE_NAME); allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; if (!element) { @@ -409,7 +431,7 @@ element->next = allocation; } - unlock_and_exit: +unlock_and_exit: status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); return_ACPI_STATUS(status); } @@ -475,7 +497,7 @@ /* Mark the segment as deleted */ - ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); + memset(&allocation->user_space, 0xEA, allocation->size); status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); return (status); @@ -573,7 +595,7 @@ while (element) { if ((element->component & component) && ((module == NULL) - || (0 == ACPI_STRCMP(module, element->module)))) { + || (0 == strcmp(module, element->module)))) { descriptor = ACPI_CAST_PTR(union acpi_descriptor, &element->user_space); @@ -603,6 +625,7 @@ switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) { case ACPI_DESC_TYPE_OPERAND: + if (element->size == sizeof(union acpi_operand_object)) @@ -613,6 +636,7 @@ break; case ACPI_DESC_TYPE_PARSER: + if (element->size == sizeof(union acpi_parse_object)) { @@ -622,6 +646,7 @@ break; case ACPI_DESC_TYPE_NAMED: + if (element->size == sizeof(struct acpi_namespace_node)) @@ -632,6 +657,7 @@ break; default: + break; } @@ -639,6 +665,7 @@ switch (descriptor_type) { case ACPI_DESC_TYPE_OPERAND: + acpi_os_printf ("%12.12s RefCount 0x%04X\n", acpi_ut_get_type_name @@ -649,6 +676,7 @@ break; case ACPI_DESC_TYPE_PARSER: + acpi_os_printf ("AmlOpcode 0x%04hX\n", descriptor->op.asl. @@ -656,6 +684,7 @@ break; case ACPI_DESC_TYPE_NAMED: + acpi_os_printf("%4.4s\n", acpi_ut_get_node_name (&descriptor-> @@ -663,6 +692,7 @@ break; default: + acpi_os_printf("\n"); break; }