From cc4e0485045285042ad088736ef278459b139d54 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 8 Sep 2008 01:24:16 +0000 Subject: Correct the wrong '?' character to '-', and add check DestinationBuffer == SourceBuffer for CompareMem functions in all BaseMemory library instances. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5831 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c | 2 +- MdePkg/Library/PeiMemoryLib/MemLib.c | 4 ++-- MdePkg/Library/PeiMemoryLib/MemLibGuid.c | 2 +- MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c | 2 +- MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c | 2 +- MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c | 2 +- MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c | 2 +- MdePkg/Library/PeiMemoryLib/SetMemWrapper.c | 2 +- MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) (limited to 'MdePkg/Library/PeiMemoryLib') diff --git a/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c b/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c index 48948617d1..9d85c57fa3 100644 --- a/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c +++ b/MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c @@ -53,7 +53,7 @@ CompareMem ( IN UINTN Length ) { - if (Length == 0) { + if (Length == 0 || DestinationBuffer == SourceBuffer) { return 0; } ASSERT (DestinationBuffer != NULL); diff --git a/MdePkg/Library/PeiMemoryLib/MemLib.c b/MdePkg/Library/PeiMemoryLib/MemLib.c index 82e50825c0..cbd88c1c6d 100644 --- a/MdePkg/Library/PeiMemoryLib/MemLib.c +++ b/MdePkg/Library/PeiMemoryLib/MemLib.c @@ -1,7 +1,7 @@ /** @file - Base Memory Library. + Base Memory Library functions implementation bases on PeiServcie. - Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at diff --git a/MdePkg/Library/PeiMemoryLib/MemLibGuid.c b/MdePkg/Library/PeiMemoryLib/MemLibGuid.c index f7f1b16beb..db7f3588fc 100644 --- a/MdePkg/Library/PeiMemoryLib/MemLibGuid.c +++ b/MdePkg/Library/PeiMemoryLib/MemLibGuid.c @@ -102,7 +102,7 @@ CompareGuid ( If Length > 0 and Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 32-bit boundary, then ASSERT(). If Length is not aligned on a 128-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Pointer to the target buffer to scan. @param Length Number of bytes in Buffer to scan. diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c index 66a2cd40d9..94541f4f50 100644 --- a/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c +++ b/MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c @@ -34,7 +34,7 @@ If Length > 0 and Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Pointer to the target buffer to scan. @param Length Number of bytes in Buffer to scan. diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c index f3518b7d87..e80d730548 100644 --- a/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c +++ b/MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c @@ -34,7 +34,7 @@ If Length > 0 and Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 32-bit boundary, then ASSERT(). If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Pointer to the target buffer to scan. @param Length Number of bytes in Buffer to scan. diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c index 1bd7fe3fe5..36adb50052 100644 --- a/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c +++ b/MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c @@ -34,7 +34,7 @@ If Length > 0 and Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Pointer to the target buffer to scan. @param Length Number of bytes in Buffer to scan. diff --git a/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c b/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c index d12af184f7..b30cd320f2 100644 --- a/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c +++ b/MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c @@ -32,7 +32,7 @@ then a pointer to the matching byte in the target buffer is returned. If no match is found, then NULL is returned. If Length is 0, then NULL is returned. If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Pointer to the target buffer to scan. @param Length Number of bytes in Buffer to scan. diff --git a/MdePkg/Library/PeiMemoryLib/SetMemWrapper.c b/MdePkg/Library/PeiMemoryLib/SetMemWrapper.c index ea0a3e0106..f8c611285f 100644 --- a/MdePkg/Library/PeiMemoryLib/SetMemWrapper.c +++ b/MdePkg/Library/PeiMemoryLib/SetMemWrapper.c @@ -27,7 +27,7 @@ Fills a target buffer with a byte value, and returns the target buffer. This function fills Length bytes of Buffer with Value, and returns Buffer. - If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Memory to set. @param Length Number of bytes to set. diff --git a/MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c b/MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c index 33b9d07ecf..337b45346e 100644 --- a/MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c +++ b/MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c @@ -28,7 +28,7 @@ This function fills Length bytes of Buffer with zeros, and returns Buffer. If Length > 0 and Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Pointer to the target buffer to fill with zeros. @param Length Number of bytes in Buffer to fill with zeros. -- cgit v1.2.3