Hi all,
This is really looks like a bug. See logics:
FreePool(buff) mapped to CoreFreePool(buff) that calls CoreFreePoolI(buff); and 
we see here
--------------
EFI_STATUS
CoreFreePoolI (
  IN VOID       *Buffer
  )
{
  POOL        *Pool;
  POOL_HEAD   *Head;
  POOL_TAIL   *Tail;
  POOL_FREE   *Free;
  UINTN       Index;
  UINTN       NoPages;
  UINTN       Size;
  CHAR8       *NewPage;
  UINTN       FSize;
  UINTN       Offset;
  BOOLEAN     AllFree;

  ASSERT(Buffer != NULL);
  //
  // Get the head & tail of the pool entry
  //
  Head = CR (Buffer, POOL_HEAD, Data, POOL_HEAD_SIGNATURE);

--------------
BUT!!!  CR macro assumed Buffer to be a record of type POOL_HEAD while we have 
just an empty space
------
  #define CR(Record, TYPE, Field, TestSignature)                                
              \
    (DebugAssertEnabled () && (BASE_CR (Record, TYPE, Field)->Signature != 
TestSignature)) ?  \
    (TYPE *) (_ASSERT (CR has Bad Signature), Record) :                         
              \
    BASE_CR (Record, TYPE, Field)

------
Yes, the empty space is not equal to TestSignature.

I just don't know how deep is this mistake.

Sergey


On 08.07.2014, at 14:26, WANG Siyuan wrote:

> Dear All,
> I use AllocateZeroPool to allocate memory and use FreePool to free:
> 
> UINT8 *buff = (UINT8 *)AllocateZeroPool(len);
> FreePool(buff);
> 
> But I got this error:
> ASSERT MdeModulePkg\Core\Dxe\Mem\Pool.c(425): CR has Bad Signature
> 
> What is the problem? 
> Can I use other method to do this? I use VC tool chain which doesn't support 
> variable length array (UINT8 buff[len]).
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft_______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to