diff options
Diffstat (limited to 'MdePkg/Library/UefiMemoryLib')
-rw-r--r-- | MdePkg/Library/UefiMemoryLib/MemLibGuid.c | 8 | ||||
-rw-r--r-- | MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c | 7 |
2 files changed, 12 insertions, 3 deletions
diff --git a/MdePkg/Library/UefiMemoryLib/MemLibGuid.c b/MdePkg/Library/UefiMemoryLib/MemLibGuid.c index 06b2721c64..c54983c77b 100644 --- a/MdePkg/Library/UefiMemoryLib/MemLibGuid.c +++ b/MdePkg/Library/UefiMemoryLib/MemLibGuid.c @@ -119,6 +119,14 @@ ScanGuid ( {
CONST GUID *GuidPtr;
+ ASSERT (Buffer != NULL);
+ //
+ // Make sure Buffer is aligned on a 64-bit boundary.
+ //
+ ASSERT (((UINTN) Buffer & 7) == 0);
+
+ ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
+
GuidPtr = (GUID*)Buffer;
Buffer = GuidPtr + Length / sizeof (*GuidPtr);
while (GuidPtr < (CONST GUID*)Buffer) {
diff --git a/MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c b/MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c index d7d7919ba2..4a3d615ce5 100644 --- a/MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c +++ b/MdePkg/Library/UefiMemoryLib/ZeroMemWrapper.c @@ -43,9 +43,10 @@ VOID * EFIAPI
ZeroMem (
IN VOID *Buffer,
- IN UINTN Size
+ IN UINTN Length
)
{
- ASSERT (Buffer != NULL);
- return InternalMemSetMem (Buffer, Size, 0);
+ ASSERT (!(Buffer == NULL && Length > 0));
+ ASSERT (Length <= (MAX_ADDRESS - (UINTN)Buffer + 1));
+ return InternalMemSetMem (Buffer, Length, 0);
}
|