summaryrefslogtreecommitdiff
path: root/OptionRomPkg/AtapiPassThruDxe
diff options
context:
space:
mode:
Diffstat (limited to 'OptionRomPkg/AtapiPassThruDxe')
-rw-r--r--OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c b/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c
index d2a9d7b11e..3578a1e445 100644
--- a/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c
+++ b/OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c
@@ -1749,10 +1749,12 @@ Returns:
{
UINT8 Index;
UINT8 *OpCode;
+ UINT8 ArrayLen;
OpCode = (UINT8 *) (Packet->Cdb);
+ ArrayLen = (UINT8) (sizeof (gSupportedATAPICommands) / sizeof (gSupportedATAPICommands[0]));
- 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) {
//
@@ -1990,10 +1992,12 @@ Returns:
{
UINT8 Index;
UINT8 *OpCode;
+ UINT8 ArrayLen;
OpCode = (UINT8 *) (Packet->Cdb);
+ ArrayLen = (UINT8) (sizeof (gSupportedATAPICommands) / sizeof (gSupportedATAPICommands[0]));
- 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) {
//