summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c')
-rw-r--r--MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c b/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c
index 9ffc2cf159..29170594d3 100644
--- a/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c
+++ b/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c
@@ -19,7 +19,7 @@
BaseMemoryLibSse2
BaseMemoryLibRepStr
PeiMemoryLib
- UefiMemoryLib
+ DxeMemoryLib
**/
@@ -35,6 +35,7 @@
then NULL is returned. If Length is 0, then NULL is returned.
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().
@param Buffer Pointer to the target buffer to scan.
@@ -52,16 +53,14 @@ ScanMem16 (
IN UINT16 Value
)
{
- UINTN Stride;
-
- Stride = Length / sizeof (Value);
- if (Stride == 0) {
+ if (Length == 0) {
return NULL;
}
ASSERT (Buffer != NULL);
ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
+ ASSERT ((Length & (sizeof (Value) - 1)) == 0);
- return (VOID*)InternalMemScanMem16 (Buffer, Stride, Value);
+ return (VOID*)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value);
}