Hi Mcdaniel, Thanks your reply.
However, if use malloc() function to allocate memory and free memory by gBS->FreePool(), it will cause CPOOL_HEAD doubly-linked list is incorrect. Thanks, Bin -----Original message----- From:Mcdaniel, Daryl <[email protected]> To:bin_601 <[email protected]>,[email protected] <[email protected]> Date:Fri, 07 Mar 2014 09:10:51 Subject:RE: [edk2] Bug in realloc() function of StdLib A fix for this problem has been committed to the EDK II repository as rev:15319. The relevant part of the commit description follows: StdLib: Modify the memory allocation routines to not be dependent upon the internal structure of the EDK II memory pool. StdLib/LibC/StdLib/Malloc.c Create a private data structure, CPOOL_HEAD, which contains housekeeping information for StdLib's memory allocation functions. An instance of this structure is prepended to every chunk of allocated memory. The structure links the allocation into a doubly-linked list and keeps track of the size of each allocation unit. This information is then available for use by the realloc function. Daryl McDaniel "I don't try to describe the future. I try to prevent it" -- Ray Bradbury -----Original Message----- From: bin_601 [mailto:[email protected]] Sent: Monday, February 03, 2014 11:21 PM To: edk2-devel Subject: [edk2] Bug in realloc() function of StdLib Dear all, After EDK2 rev:14820 MdeModulePkg Pool: Update the type of Size to UINTN for the potential more than 4GB buffer allocation. It modify the POOL_HEAD structure in MdeModulePkg\Core\Dxe\Mem\Pool.c, however it doesn't sync to the POOL_HEAD structure in StdLib\LibC\StdLib\Malloc.c. Original: typedef struct { UINT32 Signature; UINT32 Size; EFI_MEMORY_TYPE Type; UINTN Reserved; CHAR8 Data[1]; } POOL_HEAD; Modified: typedef struct { UINT32 Signature; UINT32 Reserved; ^^^^^^^^^^^^^^^^^^^^^^^^ EFI_MEMORY_TYPE Type; UINTN Size; ^^^^^^^^^^^^^^^^^^^^ CHAR8 Data[1]; } POOL_HEAD; Thanks, Bin Lain ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
