diff options
Diffstat (limited to 'MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c')
-rw-r--r-- | MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c b/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c index c2f62855fd..4fc695ee61 100644 --- a/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c +++ b/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c @@ -68,7 +68,11 @@ InvalidateInstructionCacheRange ( IN UINTN Length
)
{
- ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
+ if (Length == 0) {
+ return Address;
+ }
+
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Address));
return Address;
}
@@ -127,12 +131,12 @@ WriteBackInvalidateDataCacheRange ( UINTN Start;
UINTN End;
- ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
-
if (Length == 0) {
return Address;
}
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Address));
+
Start = (UINTN)Address;
//
// Calculate the cache line alignment
|