X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=OptionRomPkg%2FAtapiPassThruDxe%2FAtapiPassThru.c;h=e6e2b36809d009ca24a424f296c04e7cf3bb2b33;hb=118f1657b9c6c338c25ef81e6c30ece392138673;hp=43b18113d255ed236c0a931eaa2ade274cd03789;hpb=5781db0852b91fd68d9d691dff30f525d75acb12;p=mirror_edk2.git diff --git a/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c b/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c index 43b18113d2..e6e2b36809 100644 --- a/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c +++ b/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials + Copyright (c) 2006, 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 http://opensource.org/licenses/bsd-license.php @@ -300,7 +300,7 @@ AtapiScsiPassThruDriverBindingStop ( Routine Description: - Stop this driver on ControllerHandle. Support stoping any child handles + Stop this driver on ControllerHandle. Support stopping any child handles created by this driver. Arguments: @@ -1749,10 +1749,12 @@ Returns: { UINT8 Index; UINT8 *OpCode; + UINT8 ArrayLen; OpCode = (UINT8 *) (Packet->Cdb); + ArrayLen = (UINT8) (ARRAY_SIZE (gSupportedATAPICommands)); - for (Index = 0; CompareMem (&gSupportedATAPICommands[Index], &gEndTable, sizeof (SCSI_COMMAND_SET)); Index++) { + for (Index = 0; (Index < ArrayLen) && (CompareMem (&gSupportedATAPICommands[Index], &gEndTable, sizeof (SCSI_COMMAND_SET)) != 0); Index++) { if (*OpCode == gSupportedATAPICommands[Index].OpCode) { // @@ -1883,11 +1885,11 @@ RequestSenseCommand ( Routine Description: - Sumbit request sense command + Submit request sense command Arguments: - AtapiScsiPrivate - The pionter of ATAPI_SCSI_PASS_THRU_DEV + AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV Target - The target ID Timeout - The time to complete the command SenseData - The buffer to fill in sense data @@ -1990,10 +1992,12 @@ Returns: { UINT8 Index; UINT8 *OpCode; + UINT8 ArrayLen; OpCode = (UINT8 *) (Packet->Cdb); + ArrayLen = (UINT8) (ARRAY_SIZE (gSupportedATAPICommands)); - for (Index = 0; CompareMem (&gSupportedATAPICommands[Index], &gEndTable, sizeof (SCSI_COMMAND_SET)); Index++) { + for (Index = 0; (Index < ArrayLen) && (CompareMem (&gSupportedATAPICommands[Index], &gEndTable, sizeof (SCSI_COMMAND_SET)) != 0); Index++) { if (*OpCode == gSupportedATAPICommands[Index].OpCode) { //