diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c index 29f4508a38..0c1f252b85 100644 --- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c +++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c @@ -769,7 +769,7 @@ ConvertFilter ( Count = sizeof (gTable)/sizeof (gTable[0]); - for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) { + for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) { if (gTable[Index].Src & Value) { *CdcFilter |= gTable[Index].Dst; } diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c index baa2225bf8..ef01a6f545 100644 --- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c +++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c @@ -855,7 +855,7 @@ ConvertFilter ( Count = sizeof (gTable)/sizeof (gTable[0]); - for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) { + for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) { if (gTable[Index].Src & Value) { *CdcFilter |= gTable[Index].Dst; } diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c index 2c0dcae4cf..6d45a1b775 100644 --- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c +++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c @@ -803,7 +803,7 @@ ConvertFilter ( Count = sizeof (gTable)/sizeof (gTable[0]); - for (Index = 0; (gTable[Index].Src != 0) && (Index < Count); Index++) { + for (Index = 0; (Index < Count) && (gTable[Index].Src != 0); Index++) { if (gTable[Index].Src & Value) { *CdcFilter |= gTable[Index].Dst; }