/** @file\r
UEFI Memory pool management functions.\r
\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
#include "DxeMain.h"\r
#include "Imem.h"\r
\r
-#define POOL_FREE_SIGNATURE EFI_SIGNATURE_32('p','f','r','0')\r
+#define POOL_FREE_SIGNATURE SIGNATURE_32('p','f','r','0')\r
typedef struct {\r
UINT32 Signature;\r
UINT32 Index;\r
} POOL_FREE;\r
\r
\r
-#define POOL_HEAD_SIGNATURE EFI_SIGNATURE_32('p','h','d','0')\r
+#define POOL_HEAD_SIGNATURE SIGNATURE_32('p','h','d','0')\r
typedef struct {\r
UINT32 Signature;\r
UINT32 Size;\r
CHAR8 Data[1];\r
} POOL_HEAD;\r
\r
-#define SIZE_OF_POOL_HEAD EFI_FIELD_OFFSET(POOL_HEAD,Data)\r
+#define SIZE_OF_POOL_HEAD OFFSET_OF(POOL_HEAD,Data)\r
\r
-#define POOL_TAIL_SIGNATURE EFI_SIGNATURE_32('p','t','a','l')\r
+#define POOL_TAIL_SIGNATURE SIGNATURE_32('p','t','a','l')\r
typedef struct {\r
UINT32 Signature;\r
UINT32 Size;\r
// Globals\r
//\r
\r
-#define POOL_SIGNATURE EFI_SIGNATURE_32('p','l','s','t')\r
+#define POOL_SIGNATURE SIGNATURE_32('p','l','s','t')\r
typedef struct {\r
INTN Signature;\r
UINTN Used;\r
// MemoryType values in the range 0x80000000..0xFFFFFFFF are reserved for use by UEFI \r
// OS loaders that are provided by operating system vendors\r
//\r
- if (MemoryType < 0) {\r
+ if (MemoryType >= (INT32)0x80000000 && MemoryType <= (INT32)0xffffffff) {\r
\r
for (Link = mPoolHeadList.ForwardLink; Link != &mPoolHeadList; Link = Link->ForwardLink) {\r
Pool = CR(Link, POOL, Link, POOL_SIGNATURE);\r
@param Buffer The address to return a pointer to the allocated\r
pool\r
\r
- @retval EFI_INVALID_PARAMETER PoolType not valid\r
+ @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL. \r
@retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r
@retval EFI_SUCCESS Pool successfully allocated.\r
\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ if (Buffer == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
*Buffer = NULL;\r
\r
//\r