//\r
// Start to parse the bars\r
//\r
- for (Offset = 0x10, BarIndex = 0; Offset <= 0x24; BarIndex++) {\r
+ for (Offset = 0x10, BarIndex = 0; Offset <= 0x24 && BarIndex < PCI_MAX_BAR; BarIndex++) {\r
Offset = PciParseBar (PciIoDevice, Offset, BarIndex);\r
}\r
\r
}\r
}\r
\r
- if (EFI_ERROR (Status)) {\r
+ if (EFI_ERROR (Status) || Configuration == NULL ) {\r
return EFI_UNSUPPORTED;\r
}\r
\r