From ec99fa8efb51379e722c6955bb66da3d3b721aea Mon Sep 17 00:00:00 2001 From: erictian Date: Wed, 21 Sep 2011 06:59:17 +0000 Subject: fix build error. Signed-off-by: erictian Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12401 6f19259b-4bc3-4df7-8a09-765794883524 --- .../DebugCommunicationLibUsb/DebugCommunicationLibUsb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'SourceLevelDebugPkg/Library/DebugCommunicationLibUsb') diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c index 59189db0dc..3dd1e3a62c 100644 --- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c +++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c @@ -285,7 +285,10 @@ UsbDebugPortIn ( } *Length = (UINT8)(MmioRead32((UINTN)&DebugPortRegister->ControlStatus) & 0xF); - ASSERT (*Length <= 8); + if (*Length > 8) { + return RETURN_DEVICE_ERROR; + } + for (Index = 0; Index < *Length; Index++) { Buffer[Index] = DebugPortRegister->DataBuffer[Index]; } @@ -643,7 +646,11 @@ InitializeUsbDebugHardware ( // return Status; } - ASSERT (Length == sizeof(USB_DEBUG_PORT_DESCRIPTOR)); + + if (Length != sizeof(USB_DEBUG_PORT_DESCRIPTOR)) { + return RETURN_DEVICE_ERROR; + } + // // set usb debug device address as 0x7F. // -- cgit v1.2.3