From d908a2d6d24d7a972a449cdc9a16878e1835d87a Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Thu, 23 Apr 2009 08:08:48 +0000 Subject: [PATCH] Add checking for start address for PCI express Read/Write Buffer git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8160 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c b/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c index 696f7bbf47..e6a3faa813 100644 --- a/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c +++ b/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c @@ -222,7 +222,7 @@ GetPciExpressAddress ( } // - // Search the entire table for a phyical address match + // Search the entire table for a physical address match // for (Index = 0; Index < mDxeRuntimePciExpressLibNumberOfRuntimeRanges; Index++) { if (mDxeRuntimePciExpressLibRegistrationTable[Index].PhysicalAddress == (Address & 0x0ffff000)) { @@ -1471,6 +1471,10 @@ PciExpressReadBuffer ( { UINTN ReturnValue; + // + // Make sure Address is valid + // + ASSERT (((StartAddress) & ~0xfffffff) == 0); ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); if (Size == 0) { @@ -1570,6 +1574,10 @@ PciExpressWriteBuffer ( { UINTN ReturnValue; + // + // Make sure Address is valid + // + ASSERT (((StartAddress) & ~0xfffffff) == 0); ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000); if (Size == 0) { -- 2.39.2