diff options
author | marks <marks@FreeBSD.org> | 2004-12-01 23:14:10 +0000 |
---|---|---|
committer | marks <marks@FreeBSD.org> | 2004-12-01 23:14:10 +0000 |
commit | 93c2522130390c12e9ae98f3278c17f381a0db90 (patch) | |
tree | 4910f03edb15ce309eeb1b58facc922df30dd767 /sys/contrib/dev/acpica/utalloc.c | |
parent | f84f460530aa9bde251160a8ebad4c1048e94251 (diff) | |
download | FreeBSD-src-93c2522130390c12e9ae98f3278c17f381a0db90.zip FreeBSD-src-93c2522130390c12e9ae98f3278c17f381a0db90.tar.gz |
Vendor import of Intel ACPI-CA 20041119
Diffstat (limited to 'sys/contrib/dev/acpica/utalloc.c')
-rw-r--r-- | sys/contrib/dev/acpica/utalloc.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utalloc.c index ce036fe..b96cd5a 100644 --- a/sys/contrib/dev/acpica/utalloc.c +++ b/sys/contrib/dev/acpica/utalloc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utalloc - local cache and memory allocation routines - * $Revision: 135 $ + * $Revision: 138 $ * *****************************************************************************/ @@ -345,13 +345,13 @@ AcpiUtValidateBuffer ( * * FUNCTION: AcpiUtInitializeBuffer * - * PARAMETERS: RequiredLength - Length needed - * Buffer - Buffer to be validated + * PARAMETERS: Buffer - Buffer to be validated + * RequiredLength - Length needed * * RETURN: Status * * DESCRIPTION: Validate that the buffer is of the required length or - * allocate a new buffer. + * allocate a new buffer. Returned buffer is always zeroed. * ******************************************************************************/ @@ -393,26 +393,27 @@ AcpiUtInitializeBuffer ( /* Allocate a new buffer with local interface to allow tracking */ - Buffer->Pointer = ACPI_MEM_ALLOCATE (RequiredLength); + Buffer->Pointer = ACPI_MEM_CALLOCATE (RequiredLength); if (!Buffer->Pointer) { return (AE_NO_MEMORY); } - - /* Clear the buffer */ - - ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); break; default: - /* Validate the size of the buffer */ + /* Existing buffer: Validate the size of the buffer */ if (Buffer->Length < RequiredLength) { Status = AE_BUFFER_OVERFLOW; + break; } + + /* Clear the buffer */ + + ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); break; } @@ -566,7 +567,7 @@ AcpiUtAllocateAndTrack ( ACPI_STATUS Status; - Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK), Component, + Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER), Component, Module, Line); if (!Allocation) { @@ -614,7 +615,7 @@ AcpiUtCallocateAndTrack ( ACPI_STATUS Status; - Allocation = AcpiUtCallocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK), Component, + Allocation = AcpiUtCallocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER), Component, Module, Line); if (!Allocation) { @@ -703,7 +704,8 @@ AcpiUtFreeAndTrack ( * * FUNCTION: AcpiUtFindAllocation * - * PARAMETERS: Allocation - Address of allocated memory + * PARAMETERS: ListId - Memory list to search + * Allocation - Address of allocated memory * * RETURN: A list element if found; NULL otherwise. * @@ -749,7 +751,8 @@ AcpiUtFindAllocation ( * * FUNCTION: AcpiUtTrackAllocation * - * PARAMETERS: Allocation - Address of allocated memory + * PARAMETERS: ListId - Memory list to search + * Allocation - Address of allocated memory * Size - Size of the allocation * AllocType - MEM_MALLOC or MEM_CALLOC * Component - Component type of caller @@ -816,6 +819,7 @@ AcpiUtTrackAllocation ( Allocation->Line = Line; ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); + Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0; /* Insert at list head */ @@ -840,7 +844,8 @@ UnlockAndExit: * * FUNCTION: AcpiUtRemoveAllocation * - * PARAMETERS: Allocation - Address of allocated memory + * PARAMETERS: ListId - Memory list to search + * Allocation - Address of allocated memory * Component - Component type of caller * Module - Source file name of caller * Line - Line number of caller |